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

Response object is using deprecated @ember/error #1082

Open
jkantner opened this issue Feb 1, 2023 · 1 comment
Open

Response object is using deprecated @ember/error #1082

jkantner opened this issue Feb 1, 2023 · 1 comment

Comments

@jkantner
Copy link

jkantner commented Feb 1, 2023

When I use the special Response object from miragejs, this deprecation warning appears in the console:

DEPRECATION: The @ember/error package merely re-exported the native Error and is deprecated. Please use a native Error directly instead. [deprecation id: deprecate-ember-error] This will be removed in ember-source 5.0.0. See https://deprecations.emberjs.com/v4.x/#toc_deprecate-ember-error for more details.
    @http://localhost:4200/assets/vendor.js:23477:17
    raiseOnDeprecation@http://localhost:4200/assets/vendor.js:23381:13
    @http://localhost:4200/assets/vendor.js:23477:17
    handleDeprecationWorkflow@http://localhost:4200/assets/vendor.js:56307:13
    @http://localhost:4200/assets/vendor.js:23477:17
    deprecationCollector@http://localhost:4200/assets/vendor.js:56342:9
    @http://localhost:4200/assets/vendor.js:23477:17
    invoke@http://localhost:4200/assets/vendor.js:23486:23
    deprecate@http://localhost:4200/assets/vendor.js:23454:28
    EmberDebugConstructor@http://localhost:4200/assets/vendor.js:24586:49
    AdapterError@http://localhost:4200/assets/vendor.js:57098:36
    ErrorClass@http://localhost:4200/assets/vendor.js:57129:28
    handleResponse@http://localhost:4200/assets/vendor.js:59245:42
    ajaxError@http://localhost:4200/assets/vendor.js:59534:39
    @http://localhost:4200/assets/vendor.js:59322:34
    asyncFunctionResume@[native code]
    @[native code]
    promiseReactionJobWithoutPromise@[native code]

It happens when returning the object like this:

new Response(404, {}, { detail: 'Not found' }

It’s seems that a deprecated non-native error is being used somewhere.

@TSenter
Copy link

TSenter commented Mar 25, 2024

Where did you import Response from? An older version of ember-cli-mirage re-exported the Response class and might have imported that package. The base miragejs package shouldn't be dependent on Ember.js at all.

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

No branches or pull requests

2 participants