question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

example-client: better error handling

See original GitHub issue

The example client has two conflicting goals:

  • provide “production-like” error messages: don’t dump a 300 line stack trace if the network is down
  • be a useful debugging tool

For an example of the second I modified the example client to use some real world repositories: the error messages I got were mostly useless – I needed to remove the error handling in the example app to see what the errors were.

So I suggest a couple of things:

  • DeserializationError needs an actual error message when it’s raised – failure to deserialize local root metadata currently looks like following, note the missing error message on last line (this can be reproduced by just modifying the local root.json file so it is invalid). This should now be fixed with #1876
    $ ./client_example.py  download x
    Found trusted root in /home/jku/.local/share/python-tuf-client-example
    Failed to download target x: 
    
  • Maybe there should be a way to see the actual stack trace, and that should be documented in the error message. So a hypothetical normal failure would look like:
    $ ./client_example.py download x
    Found trusted root in /home/jku/.local/share/python-tuf-client-example
    Failed to download target x: Failed to transmogrify metadata
      (For detailed traceback use "-v")
    
    and then using -v would raise e instead of handling it? This would be a small change in client_example itself

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
ameypdcommented, Sep 7, 2022

I would like to take this up as my first PR.

1reaction
ameypdcommented, Nov 23, 2022

@jku @lukpueh I have passed verbose as parameter to download function and if the verbose is anything other than default I am printing the stack trace. image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maintainable error handling with Feign clients? Not a dream ...
I'm going to use a custom annotation to mark methods or the client class which needs special treatment on its error handling:.
Read more >
Handling operation errors - Apollo GraphQL Docs
Apollo Client can encounter a variety of errors when executing operations on your GraphQL server. Apollo Client helps you handle these errors according...
Read more >
Advanced error handling techniques - Enterprise Craftsmanship
This post describes some (more) advanced error handling techniques. I'll probably do a series because this topic is large and there's quite ...
Read more >
Example client errors - Product Documentation | ServiceNow
Example client errors · Client JavaScript errors · Other client script errors · Script resource links by Sys ID · Script access permissions....
Read more >
Handling Exceptions and Faults - WCF | Microsoft Learn
The three essential parts of a good exception message are: ... faultCode values (for example, Client and Server) that can be extended either ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found