Skip to content

Commit 772827d

Browse files
committed
Throw error with status code on empty namespace
When throwing an error without status code it resolve in a 500 error. Using an error with a status code resolve in more explicit errors.
1 parent ff5e55c commit 772827d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/datastore/DataStoreProvider.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ const dataStoreCache: IHashMapGeneric<DataStore> = {}
1111
export default {
1212
getDataStore: function (namespace: string) {
1313
if (!namespace) {
14-
throw new Error('NameSpace is empty')
14+
throw ApiStatusCodes.createError(
15+
ApiStatusCodes.STATUS_ERROR_NOT_AUTHORIZED,
16+
'Empty namespace'
17+
)
1518
}
1619

1720
if (namespace !== CaptainConstants.rootNameSpace) {

0 commit comments

Comments
 (0)