Skip to content

Commit

Permalink
refactor: Use createError instead of new Error
Browse files Browse the repository at this point in the history
  • Loading branch information
becem-gharbi committed Oct 4, 2023
1 parent bde7969 commit b185d29
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt-s3",
"version": "0.1.14-edge",
"version": "0.1.15-edge",
"description": "Edge compatible S3 client for Nuxt3",
"repository": "becem-gharbi/nuxt-s3-edge",
"license": "MIT",
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/composables/useS3Object.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { v4 as uuidv4 } from 'uuid'
import { useNuxtApp, useRuntimeConfig } from '#imports'
import { useNuxtApp, useRuntimeConfig, createError } from '#imports'

export default function () {
const { callHook } = useNuxtApp()
Expand Down Expand Up @@ -100,14 +100,14 @@ export default function () {
const regex = new RegExp(config.public.s3.accept)

if (!regex.test(type)) {
throw new Error('invalid-type')
throw createError('invalid-type')
}
}

function verifySize (size: number) {
const maxSizeMb = config.public.s3.maxSizeMb
if (maxSizeMb && size > maxSizeMb * 1000000) {
throw new Error('invalid-size')
throw createError('invalid-size')
}
}

Expand Down

0 comments on commit b185d29

Please sign in to comment.