Skip to content

Commit

Permalink
improve inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
mifi committed Dec 1, 2023
1 parent 70a7a48 commit 0d81a9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/@uppy/companion/src/server/logger.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const chalk = require('chalk')
const escapeStringRegexp = require('escape-string-regexp')
const util = require('node:util')
const { ProviderApiError, ProviderUserError, ProviderAuthError } = require('./provider/error')
const { ProviderApiError } = require('./provider/error')

const valuesToMask = []
/**
Expand Down Expand Up @@ -56,7 +56,7 @@ const log = ({ arg, tag = '', level, traceId = '', color = (message) => message
function msgToString () {
// We don't need to log stack trace on special errors that we ourselves have produced
// (to reduce log noise)
if ((arg instanceof ProviderApiError || arg instanceof ProviderUserError || arg instanceof ProviderAuthError) && typeof arg.message === 'string') {
if ((arg instanceof ProviderApiError) && typeof arg.message === 'string') {
return arg.message
}
if (typeof arg === 'string') return arg
Expand Down
4 changes: 2 additions & 2 deletions packages/@uppy/companion/src/server/provider/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ class ProviderApiError extends Error {
}
}

class ProviderUserError extends Error {
class ProviderUserError extends ProviderApiError {
/**
* @param {object} json arbitrary JSON.stringify-able object that will be passed to the client
*/
constructor (json) {
super('User error')
super('User error', undefined)
this.json = json
}
}
Expand Down

0 comments on commit 0d81a9b

Please sign in to comment.