NotifiableError typed to any
See original GitHub issueHi, I was just wondering why NotifableError is typed to any when it doesn’t accept any?
I naively passed in an unknown response object to client.notify()
and get no errors in typescript yet in production I get the not so helpful Bugsnag usage error. notify() expected error/opts parameters, got unsupported object
. This is exactly the sort of error typescript is great for avoiding. If the any type was removed from the below I would’ve got this right first time:
export type NotifiableError = Error
| { errorClass: string; errorMessage: string; }
| { name: string; message: string; }
| any;
Am I missing something? It seems like dropping any would resolve the runtime issue by catching it at compile time.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Laravel NotificationFake.php sendNow causes Illegal offset ...
Laravel NotificationFake.php sendNow causes Illegal offset type error when notifiable->id is an uuid ; public function test_send_notification(): ...
Read more >Flow Chart for Determining if an Error is a Minor Incident
Flow Chart for Determining if an Error is a Minor Incident. Minor Incident = conduct by a nurse that may be a violation...
Read more >How NNDSS Conducts Case Surveillance - CDC
Understand the process NNDSS uses to collect national notifiable disease data on behalf of CDC in order to support public health agencies.
Read more >Error Reporting and Disclosure - Patient Safety and Quality
Background. This chapter examines reporting of health care errors (e.g., verbal, written, or other form of communication and/or recording of near miss and ......
Read more >STIs That Are Nationally Notifiable Diseases - Verywell Health
Being aware of any concentrated epidemics or new outbreaks allows the government to intervene with prevention and/or treatment measures most ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @toxaq, a fix for this was released in v7.0.0
Hi @bengourley ! Appreciate the response.
Old school Visual Studio C# dev here but since moved on to OSX now with typescript. So I appreciate the benefits of intellisense autofill but the real benefit to me is the typescript compiler, so dropping
any
would’ve flagged my runtime issue well before finding theunsupported object
logs in bugsnag.The 3rd party library is precompiled minified javascript, so whilst I could trawl through it, all I know is it returns an error object, just not an actual
Error
object. So for me the ideal solution would be that bugsnag would fall back to stringifying the unknown object and would be happy if the error name wasreceived unknown object
and the message was the object values. That way with the information of the object I could better handle it and even write some tests based on an exact object.Thanks for taking the time to look at this.