You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, first of all I just want to say, this project is incredible! I love having a REST API at my fingertips, and I've written some shell scripts to interact with it without having to think about the backend at all, which is fantastic.
I like to pipe the output of my requests to jq, for some pretty JSON printing:
However, sometimes the response is plaintext, not JSON... (for example, The auction has already ended.). This breaks the JSON parser and causes some annoying corner cases.
I would love to have the response be similar to:
{"error": "The auction has already ended."}
I'm thinking of throwing a PR together this weekend. Let me know if you have any pointers. I'm thinking that simply defining "error" implies an error, otherwise if it's undefined... then no error.
So in any language you could grab the result and run a control structure such as:
Hi @ryanmjacobs, I'm glad you like the project! Your idea makes total sense.
If you just need JSON error responses for domain-specific errors (like auction ended or no snipe found) it suffices to replace the string messages in SnipeServer.scala with a new SnipeError(error: String) case class. If you want to handle all server errors (like unexpected throws or wrong URIs) you'll probably want to make use of a custom akka-http exception handler.
Hi, first of all I just want to say, this project is incredible! I love having a REST API at my fingertips, and I've written some shell scripts to interact with it without having to think about the backend at all, which is fantastic.
I like to pipe the output of my requests to
jq
, for some pretty JSON printing:However, sometimes the response is plaintext, not JSON... (for example,
The auction has already ended.
). This breaks the JSON parser and causes some annoying corner cases.I would love to have the response be similar to:
I'm thinking of throwing a PR together this weekend. Let me know if you have any pointers. I'm thinking that simply defining "error" implies an error, otherwise if it's undefined... then no error.
So in any language you could grab the result and run a control structure such as:
Plaintext error strings that I've noticed:
The requested resource could not be found.
The auction has already ended.
The text was updated successfully, but these errors were encountered: