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

Ada: better error messages #13

Open
onnozweers opened this issue Jul 31, 2024 · 1 comment
Open

Ada: better error messages #13

onnozweers opened this issue Jul 31, 2024 · 1 comment

Comments

@onnozweers
Copy link
Contributor

Now, when a user is not authorized, Ada often returns "Could not determine object type". This is not a very helpful message. We need to catch the real error the API returns to Curl, and make that visible to the user.

@onnozweers
Copy link
Contributor Author

It's mainly this piece of code.

pathtype () {
  # Get the type of an object. Possible outcomes:
  # DIR     = directory
  # REGULAR = file
  # LINK    = symbolic link
  # <empty> = something went wrong... no permission?
  local path
  path=$(urlencode "$1")
  curl "${curl_authorization[@]}" \
       "${curl_options_no_errors[@]}" \
       -X GET "$api/namespace/$path" \
  | jq -r .fileType
}

pathtype () {

The HTTP code returned by curl is not caught. We need to catch it, and if there is an error (code not in range 200-399, or unexpected output): print it and exit with an exit code not 0.

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