Skip to content

Improve error handling#7

Open
xird wants to merge 1 commit intoskyderby:masterfrom
xird:feature/improve-error-handling
Open

Improve error handling#7
xird wants to merge 1 commit intoskyderby:masterfrom
xird:feature/improve-error-handling

Conversation

@xird
Copy link
Copy Markdown

@xird xird commented Aug 1, 2023

No description provided.

@xird
Copy link
Copy Markdown
Author

xird commented Aug 1, 2023

I tried to fix skyderby/skyderby#434 , but ran into a couple of issues:

  • I added a try-catch block on the line where the track scanner crashes if the timestamps are not in order. I couldn't figure out how to check the exception type to return a more specific error message when "ValueError: index must be monotonic" is raised.
  • For some reason, the "Oops, something went wrong" that's shown on 500's in production doesn't pop up on my local. I assume that there is some other message when a 422 is returned?

@xird
Copy link
Copy Markdown
Author

xird commented Aug 1, 2023

And this is still showing up in the main program's logs:

Started POST "/api/v1/tracks" for 127.0.0.1 at 2023-08-01 17:04:43 +0300
Processing by Api::V1::TracksController#create as JSON
  Parameters: {"track"=>{"comment"=>"", "location"=>"FAIL", "kind"=>"skydive", "visibility"=>"public_track", "trackFileId"=>8, "segment"=>0, "suitId"=>3}}
  User Load (0.4ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 2], ["LIMIT", 1]]
  Profile Load (0.2ms)  SELECT "profiles".* FROM "profiles" WHERE "profiles"."owner_id" = $1 AND "profiles"."owner_type" = $2 LIMIT $3  [["owner_id", 2], ["owner_type", "User"], ["LIMIT", 1]]
  Announcement Load (0.3ms)  SELECT "announcements".* FROM "announcements" WHERE (NOW() BETWEEN period_from AND period_to)
Unpermitted parameter: :segment. Context: { controller: Api::V1::TracksController, action: create, request: #<ActionDispatch::Request:0x00007f06daabf698>, params: {"track"=>{"comment"=>"", "location"=>"FAIL", "kind"=>"skydive", "visibility"=>"public_track", "trackFileId"=>8, "segment"=>0, "suitId"=>3}, "format"=>:json, "controller"=>"api/v1/tracks", "action"=>"create"} }
  TRANSACTION (0.1ms)  BEGIN
  Track::File Load (0.3ms)  SELECT "track_files".* FROM "track_files" WHERE "track_files"."id" = $1 LIMIT $2  [["id", 8], ["LIMIT", 1]]
  TRANSACTION (0.3ms)  ROLLBACK
Completed 500 Internal Server Error in 462ms (ActiveRecord: 1.5ms | Allocations: 866792)

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

Successfully merging this pull request may close these issues.

1 participant