Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dima Krasner
Sharkey
Commits
f3164c9c
Commit
f3164c9c
authored
2 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
fix: use new for throw error
Co-Authored-By:
Acid Chicken (硫酸鶏)
<
root@acid-chicken.com
>
parent
78f061b9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/backend/src/server/web/views/flush.pug
+1
-1
1 addition, 1 deletion
packages/backend/src/server/web/views/flush.pug
packages/client/src/pages/settings/preferences-backups.vue
+9
-9
9 additions, 9 deletions
packages/client/src/pages/settings/preferences-backups.vue
with
10 additions
and
10 deletions
packages/backend/src/server/web/views/flush.pug
+
1
−
1
View file @
f3164c9c
...
...
@@ -27,7 +27,7 @@ html
.then(registrations => {
return Promise.all(registrations.map(registration => registration.unregister()));
})
.catch(e => { throw Error(e) });
.catch(e => { throw
new
Error(e) });
}
message(successText);
...
...
This diff is collapsed.
Click to expand it.
packages/client/src/pages/settings/preferences-backups.vue
+
9
−
9
View file @
f3164c9c
...
...
@@ -132,27 +132,27 @@ function isObject(value: unknown): value is Record<string, unknown> {
}
function
validate
(
profile
:
unknown
):
void
{
if
(
!
isObject
(
profile
))
throw
Error
(
'
not an object
'
);
if
(
!
isObject
(
profile
))
throw
new
Error
(
'
not an object
'
);
// Check if unnecessary properties exist
if
(
Object
.
keys
(
profile
).
some
(
key
=>
!
profileProps
.
includes
(
key
)))
throw
Error
(
'
Unnecessary properties exist
'
);
if
(
Object
.
keys
(
profile
).
some
(
key
=>
!
profileProps
.
includes
(
key
)))
throw
new
Error
(
'
Unnecessary properties exist
'
);
if
(
!
profile
.
name
)
throw
Error
(
'
Missing required prop: name
'
);
if
(
!
profile
.
misskeyVersion
)
throw
Error
(
'
Missing required prop: misskeyVersion
'
);
if
(
!
profile
.
name
)
throw
new
Error
(
'
Missing required prop: name
'
);
if
(
!
profile
.
misskeyVersion
)
throw
new
Error
(
'
Missing required prop: misskeyVersion
'
);
// Check if createdAt and updatedAt is Date
// https://zenn.dev/lollipop_onl/articles/eoz-judge-js-invalid-date
if
(
!
profile
.
createdAt
||
Number
.
isNaN
(
new
Date
(
profile
.
createdAt
).
getTime
()))
throw
Error
(
'
createdAt is falsy or not Date
'
);
if
(
!
profile
.
createdAt
||
Number
.
isNaN
(
new
Date
(
profile
.
createdAt
).
getTime
()))
throw
new
Error
(
'
createdAt is falsy or not Date
'
);
if
(
profile
.
updatedAt
)
{
if
(
Number
.
isNaN
(
new
Date
(
profile
.
updatedAt
).
getTime
()))
{
throw
Error
(
'
updatedAt is not Date
'
);
throw
new
Error
(
'
updatedAt is not Date
'
);
}
}
else
if
(
profile
.
updatedAt
!==
null
)
{
throw
Error
(
'
updatedAt is not null
'
);
throw
new
Error
(
'
updatedAt is not null
'
);
}
if
(
!
profile
.
settings
)
throw
Error
(
'
Missing required prop: settings
'
);
if
(
!
isObject
(
profile
.
settings
))
throw
Error
(
'
Invalid prop: settings
'
);
if
(
!
profile
.
settings
)
throw
new
Error
(
'
Missing required prop: settings
'
);
if
(
!
isObject
(
profile
.
settings
))
throw
new
Error
(
'
Invalid prop: settings
'
);
}
function
getSettings
():
Profile
[
'
settings
'
]
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment