Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set FirebaseError name to be calling constructors name #8553

Open
wants to merge 3 commits into
base: v11
Choose a base branch
from

Conversation

dlarocque
Copy link
Contributor

We currently set the error name to be FirebaseError and make it readonly. This means that whenever subclasses of FirebaseError call super(), the name will be locked at FirebaseError. This results in those errors from subclasses looking like:

[StorageError [FirebaseError]: Firebase Storage: An unknown error occurred, please check the error payload for server response. (storage/unknown)] {
  code: 'storage/unknown',
  customData: { serverResponse: '' },
  status_: 404,
  _baseMessage: 'Firebase Storage: An unknown error occurred, please check the error payload for server response. (storage/unknown)'
}

Subclasses should provide their own name property, so we should instead set the error name to be the name of the calling constructor. So if we do throw new StorageError, name will be StorageError. This makes errors look like this instead:

[StorageError: Firebase Storage: An unknown error occurred, please check the error payload for server response. (storage/unknown)] {
  code: 'storage/unknown',
  customData: { serverResponse: '' },
  status_: 404,
  _baseMessage: 'Firebase Storage: An unknown error occurred, please check the error payload for server response. (storage/unknown)'
}

This change will apply to all SDKs that have subclasses of FirebaseError (VertexAI, Storage, Functions, Auth).

Copy link

changeset-bot bot commented Sep 30, 2024

🦋 Changeset detected

Latest commit: ac00980

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 29 packages
Name Type
@firebase/util Patch
@firebase/analytics-compat Patch
@firebase/analytics Patch
@firebase/app-check-compat Patch
@firebase/app-check Patch
@firebase/app-compat Patch
@firebase/app Patch
@firebase/auth-compat Patch
@firebase/auth Patch
@firebase/component Patch
@firebase/database-compat Patch
@firebase/database-types Patch
@firebase/database Patch
firebase Patch
@firebase/firestore-compat Patch
@firebase/firestore Patch
@firebase/functions-compat Patch
@firebase/functions Patch
@firebase/installations-compat Patch
@firebase/installations Patch
@firebase/messaging-compat Patch
@firebase/messaging Patch
@firebase/performance-compat Patch
@firebase/performance Patch
@firebase/remote-config-compat Patch
@firebase/remote-config Patch
@firebase/storage-compat Patch
@firebase/storage Patch
@firebase/vertexai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 30, 2024

Size Report 1

Affected Products

  • @firebase/app

    TypeBase (98bbf53)Merge (0621740)Diff
    browser18.3 kB18.4 kB+67 B (+0.4%)
    main19.2 kB19.3 kB+67 B (+0.3%)
    module18.3 kB18.4 kB+67 B (+0.4%)
  • @firebase/data-connect

    TypeBase (98bbf53)Merge (0621740)Diff
    browser?19.8 kB? (?)
    main?21.5 kB? (?)
    module?19.8 kB? (?)
  • @firebase/messaging

    TypeBase (98bbf53)Merge (0621740)Diff
    browser21.3 kB21.3 kB-84 B (-0.4%)
    main21.8 kB21.7 kB-84 B (-0.4%)
    module21.3 kB21.3 kB-84 B (-0.4%)
  • @firebase/messaging-sw

    TypeBase (98bbf53)Merge (0621740)Diff
    main24.2 kB24.1 kB-59 B (-0.2%)
    module23.6 kB23.5 kB-59 B (-0.3%)
  • @firebase/performance

    TypeBase (98bbf53)Merge (0621740)Diff
    main29.5 kB29.5 kB+3 B (+0.0%)
  • @firebase/util

    TypeBase (98bbf53)Merge (0621740)Diff
    browser23.4 kB23.3 kB-22 B (-0.1%)
    main29.2 kB29.2 kB-22 B (-0.1%)
    module23.4 kB23.3 kB-22 B (-0.1%)
  • bundle

    46 size changes

    TypeBase (98bbf53)Merge (0621740)Diff
    analytics (logEvent)44.5 kB44.6 kB+53 B (+0.1%)
    app-check (CustomProvider)37.4 kB37.5 kB+53 B (+0.1%)
    app-check (ReCaptchaEnterpriseProvider)39.9 kB40.0 kB+51 B (+0.1%)
    app-check (ReCaptchaV3Provider)39.9 kB39.9 kB+51 B (+0.1%)
    auth (Anonymous)76.2 kB76.2 kB+52 B (+0.1%)
    auth (EmailAndPassword)84.5 kB84.5 kB+52 B (+0.1%)
    auth (GoogleFBTwitterGitHubPopup)103 kB103 kB+53 B (+0.1%)
    auth (GooglePopup)100 kB100 kB+52 B (+0.1%)
    auth (GoogleRedirect)100 kB100 kB+52 B (+0.1%)
    auth (Phone)86.9 kB86.9 kB+52 B (+0.1%)
    database (Append to a list of data)149 kB149 kB+53 B (+0.0%)
    database (Filtering data)148 kB148 kB+53 B (+0.0%)
    database (Listen for child events)164 kB164 kB+53 B (+0.0%)
    database (Listen for value events + Detach listeners)164 kB164 kB+53 B (+0.0%)
    database (Listen for value events)164 kB164 kB+53 B (+0.0%)
    database (Read data once)164 kB164 kB+53 B (+0.0%)
    database (Save data as transactions)166 kB166 kB+53 B (+0.0%)
    database (Sort data)150 kB150 kB+53 B (+0.0%)
    database (Write data)148 kB148 kB+53 B (+0.0%)
    firestore (CSI Auto Indexing Disable and Delete)272 kB272 kB+53 B (+0.0%)
    firestore (CSI Auto Indexing Enable)272 kB272 kB+53 B (+0.0%)
    firestore (Persistence)303 kB303 kB+53 B (+0.0%)
    firestore (Query Cursors)249 kB249 kB+51 B (+0.0%)
    firestore (Query)246 kB246 kB+51 B (+0.0%)
    firestore (Read data once)234 kB234 kB+51 B (+0.0%)
    firestore (Read Write w Persistence)328 kB328 kB+51 B (+0.0%)
    firestore (Realtime updates)236 kB236 kB+51 B (+0.0%)
    firestore (Transaction)214 kB214 kB+51 B (+0.0%)
    firestore (Write data)213 kB213 kB+51 B (+0.0%)
    firestore-lite (Query Cursors)91.4 kB91.4 kB+53 B (+0.1%)
    firestore-lite (Query)87.5 kB87.5 kB+53 B (+0.1%)
    firestore-lite (Read data once)63.0 kB63.0 kB+53 B (+0.1%)
    firestore-lite (Transaction)88.2 kB88.3 kB+53 B (+0.1%)
    firestore-lite (Write data)72.6 kB72.6 kB+53 B (+0.1%)
    functions (call)31.9 kB32.0 kB+46 B (+0.1%)
    messaging (send + receive)46.9 kB46.9 kB-22 B (-0.0%)
    performance (trace)51.7 kB51.8 kB+51 B (+0.1%)
    remote-config (getAndFetch)46.3 kB46.3 kB+53 B (+0.1%)
    storage (getBytes)42.1 kB42.1 kB+53 B (+0.1%)
    storage (getDownloadURL)44.1 kB44.2 kB+53 B (+0.1%)
    storage (getMetadata)43.6 kB43.6 kB+53 B (+0.1%)
    storage (list + listAll)43.0 kB43.1 kB+53 B (+0.1%)
    storage (updateMetadata)43.8 kB43.9 kB+53 B (+0.1%)
    storage (uploadBytes)48.7 kB48.8 kB+53 B (+0.1%)
    storage (uploadBytesResumable)58.7 kB58.7 kB+53 B (+0.1%)
    storage (uploadString)48.9 kB49.0 kB+53 B (+0.1%)

  • firebase

    30 size changes

    TypeBase (98bbf53)Merge (0621740)Diff
    firebase-analytics-compat.js26.5 kB26.5 kB+6 B (+0.0%)
    firebase-analytics.js29.7 kB29.8 kB+34 B (+0.1%)
    firebase-app-check-compat.js23.4 kB23.4 kB+6 B (+0.0%)
    firebase-app-check.js25.0 kB25.0 kB+6 B (+0.0%)
    firebase-app-compat.js31.7 kB31.8 kB+51 B (+0.2%)
    firebase-app.js103 kB103 kB+342 B (+0.3%)
    firebase-auth-compat.js139 kB139 kB+6 B (+0.0%)
    firebase-auth-cordova.js134 kB134 kB+6 B (+0.0%)
    firebase-auth-web-extension.js117 kB117 kB+6 B (+0.0%)
    firebase-auth.js151 kB151 kB+6 B (+0.0%)
    firebase-compat.js791 kB791 kB-92 B (-0.0%)
    firebase-data-connect.js?16.5 kB? (?)
    firebase-firestore-compat.js346 kB346 kB+6 B (+0.0%)
    firebase-firestore-lite.js119 kB119 kB+6 B (+0.0%)
    firebase-firestore.js440 kB440 kB+6 B (+0.0%)
    firebase-functions-compat.js8.17 kB8.18 kB+6 B (+0.1%)
    firebase-functions.js11.9 kB11.9 kB+6 B (+0.1%)
    firebase-installations-compat.js13.3 kB13.3 kB+6 B (+0.0%)
    firebase-installations.js15.1 kB15.2 kB+34 B (+0.2%)
    firebase-messaging-compat.js38.4 kB38.3 kB-137 B (-0.4%)
    firebase-messaging-sw.js30.2 kB30.1 kB-37 B (-0.1%)
    firebase-messaging.js28.7 kB28.7 kB-62 B (-0.2%)
    firebase-performance-compat.js30.8 kB30.8 kB+6 B (+0.0%)
    firebase-performance-standalone-compat.js93.6 kB94.3 kB+717 B (+0.8%)
    firebase-performance.js35.0 kB35.1 kB+34 B (+0.1%)
    firebase-remote-config-compat.js27.3 kB27.3 kB+6 B (+0.0%)
    firebase-remote-config.js29.6 kB29.6 kB+34 B (+0.1%)
    firebase-storage-compat.js40.3 kB40.3 kB+6 B (+0.0%)
    firebase-storage.js46.2 kB46.2 kB+6 B (+0.0%)
    firebase-vertexai.js22.0 kB22.0 kB+6 B (+0.0%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/XSoPqOU8J9.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 30, 2024

Size Analysis Report 1

This report is too large (235,270 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/rlnonC5Sii.html

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.

2 participants