FG
๐Ÿ”Œ APIs & SDKsTwilio

errors should inherit from the Error object

Freshalmost 9 years ago
Mar 14, 20260 views
Confidence Score88%
88%

Problem

currently twilio errors are represented as a dictionary: [code block] it would be better if errors inherited from the Error js object. there are a few reasons for this: - Error objects have stack traces, which help you nail down where they originate - makes it possible for someone to throw a Twilio error (currently a dictionary). the JS behavior for throwing/catching non-Error objects is wonky at best and handling varies by library - mocha, raven-node behave oddly when you're using them without an Error object. It would be pretty straight forward to add considering there is already a `message` property on the object.

Error Output

Error js object. there are a few reasons for this:

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Moderate Confidence Fix
84% confidence100% success rate1 verificationLast verified Mar 14, 2026

Solution: errors should inherit from the Error object

Low Risk

here's the wrapper we're using: [code block]

84

Trust Score

1 verification

100% success
  1. 1

    here's the wrapper we're using:

    here's the wrapper we're using:

Validation

Resolved in twilio/twilio-node GitHub issue #83. Community reactions: 0 upvotes.

Verification Summary

Worked: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

twiliosmsapi