mirror of
https://github.com/caprover/caprover
synced 2026-05-12 14:40:39 +00:00
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.
This commit is contained in:
@@ -11,7 +11,10 @@ const dataStoreCache: IHashMapGeneric<DataStore> = {}
|
||||
export default {
|
||||
getDataStore: function (namespace: string) {
|
||||
if (!namespace) {
|
||||
throw new Error('NameSpace is empty')
|
||||
throw ApiStatusCodes.createError(
|
||||
ApiStatusCodes.STATUS_ERROR_NOT_AUTHORIZED,
|
||||
'Empty namespace'
|
||||
)
|
||||
}
|
||||
|
||||
if (namespace !== CaptainConstants.rootNameSpace) {
|
||||
|
||||
Reference in New Issue
Block a user