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 when no meals are available #4

Open
ottojo opened this issue Aug 23, 2023 · 0 comments
Open

panic when no meals are available #4

ottojo opened this issue Aug 23, 2023 · 0 comments

Comments

@ottojo
Copy link
Owner

ottojo commented Aug 23, 2023

jonas@sol3:uulm_mensa_cli$ RUST_LOG="my_mensa_lib=trace" cargo run -- 2 menu  
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
     Running `/home/jonas/Projects/uulm_mensa_bot/target/debug/uulm_mensa_cli 2 menu`
 TRACE my_mensa_lib > Calling API url: https://stwulm.my-mensa.de/getdata.php?mensa_id=2&json=1&hyp=1&now=1692825929683&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=1692825929683&mode=togo&lang=de"), fragment: None }, status: 200, headers: {"server": "nginx", "date": "Wed, 23 Aug 2023 21:25:30 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=epa1clm7qhu0t8bppv9kclfhj9; path=/", "access-control-allow-origin": "*", "x-powered-by": "PleskLin"} }
 TRACE my_mensa_lib > Text: "{\n    \"result\": [\n        {\n            \"tag\": {\n                \"timestamp\": 1692825930,\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}"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failed to decode getdata response

Caused by:
    missing field `essen` at line 18 column 9', uulm_mensa_cli/src/main.rs:39:42

arguably a valid reason for panicing, but an explicit error would be nicer

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