Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: unknown mensa id #3

Open
ottojo opened this issue Aug 23, 2023 · 1 comment
Open

panic: unknown mensa id #3

ottojo opened this issue Aug 23, 2023 · 1 comment

Comments

@ottojo
Copy link
Owner

ottojo commented Aug 23, 2023

reproduce:

foo@bar:uulm_mensa_cli$ cargo run -- 123 menu
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failed to decode getdata response

Caused by:
    0: error decoding response body: missing field `essen` at line 18 column 9
    1: missing field `essen` at line 18 column 9', uulm_mensa_cli/src/main.rs:39:42
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@ottojo
Copy link
Owner Author

ottojo commented Aug 23, 2023

 TRACE my_mensa_lib > Calling API url: https://stwulm.my-mensa.de/getdata.php?mensa_id=2&json=1&hyp=1&now=1692825857849&mode=togo&lang=de
 TRACE my_mensa_lib > Response: Response { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("stwulm.my-mensa.de")), port: None, path: "/getdata.php", query: Some("mensa_id=2&json=1&hyp=1&now=1692825857849&mode=togo&lang=de"), fragment: None }, status: 200, headers: {"server": "nginx", "date": "Wed, 23 Aug 2023 21:24:18 GMT", "content-type": "application/json; charset=utf-8", "transfer-encoding": "chunked", "connection": "keep-alive", "expires": "Thu, 19 Nov 1981 08:52:00 GMT", "cache-control": "no-store, no-cache, must-revalidate", "pragma": "no-cache", "vary": "Accept-Encoding", "set-cookie": "PHPSESSID=rn8kktf9jcffqbmrf3ji9gbake; path=/", "access-control-allow-origin": "*", "x-powered-by": "PleskLin"} }
 TRACE my_mensa_lib > Text: "{\n    \"result\": [\n        {\n            \"tag\": {\n                \"timestamp\": 1692825858,\n                \"tag_formatiert\": \"Mi <small>(23.08.)<\\/small>\",\n                \"tag_formatiert2\": \"Mi, 23.08.2023\",\n                \"tag_formatiert_rel\": \"heute\",\n                \"jahrestag\": \"234\",\n                \"wochentag\": \"Mittwoch\",\n                \"wochentag_short\": \"Mi\",\n                \"datum\": \"23.08.\",\n                \"datum2\": \"23.08.\",\n                \"datum_iso\": \"2023-08-23\",\n                \"wota_index\": \"3\",\n                \"kw\": \"34\"\n            }\n        }\n    ],\n    \"mensaname\": \"Ulm, Universität, Cafeteria Uni West\"\n}"

note: this shows only the effect of #4, but the mensatogo.php page shows an explicit error message "Einrichtung nicht gefunden" and doesnt even call getdata.php. Interesting that getdata.php seems to guess the correct mensa ID anyways...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant