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.

NotifiableError typed to any

See original GitHub issue

Hi, 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:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
xljonescommented, Apr 14, 2020

Hi @toxaq, a fix for this was released in v7.0.0

0reactions
toxaqcommented, Nov 13, 2019

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 the unsupported 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 was received 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.

Read more comments on GitHub >

github_iconTop 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 >

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