mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Fix server error checking in API stdin endpoint
This commit is contained in:
parent
e0b0e52bd5
commit
45a1b835fb
@ -1,6 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from peewee import DoesNotExist
|
|
||||||
from app.classes.models.server_permissions import EnumPermissionsServer
|
from app.classes.models.server_permissions import EnumPermissionsServer
|
||||||
from app.classes.web.base_api_handler import BaseApiHandler
|
from app.classes.web.base_api_handler import BaseApiHandler
|
||||||
|
|
||||||
@ -27,9 +26,9 @@ class ApiServersServerStdinHandler(BaseApiHandler):
|
|||||||
# if the user doesn't have Commands permission, return an error
|
# if the user doesn't have Commands permission, return an error
|
||||||
return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"})
|
return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"})
|
||||||
|
|
||||||
try:
|
svr = self.controller.get_server_obj_optional(server_id)
|
||||||
svr = self.controller.get_server_obj(server_id)
|
if svr is None:
|
||||||
except DoesNotExist:
|
# It's in auth_data[0] but not as a Server object
|
||||||
logger.critical(
|
logger.critical(
|
||||||
"Something has gone VERY wrong! "
|
"Something has gone VERY wrong! "
|
||||||
"Crafty can't access the server object. "
|
"Crafty can't access the server object. "
|
||||||
|
Loading…
Reference in New Issue
Block a user