Ignore:
Timestamp:
Feb 26, 2024, 6:25:48 PM (9 months ago)
Author:
alloc
Message:

22.0.1.1 WebServer release

  • Moved API error codes from string literals to enum
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TFP-WebServer/WebServer/src/WebAPI/APIs/Command.cs

    r485 r486  
    9292                protected override void HandleRestPost (RequestContext _context, IDictionary<string, object> _jsonInput, byte[] _jsonInputData) {
    9393                        if (!JsonCommons.TryGetJsonField (_jsonInput, "command", out string commandString)) {
    94                                 SendEmptyResponse (_context, HttpStatusCode.BadRequest, _jsonInputData, "NO_COMMAND");
     94                                SendEmptyResponse (_context, HttpStatusCode.BadRequest, _jsonInputData, EApiErrorCode.NO_COMMAND);
    9595                                return;
    9696                        }
     
    115115
    116116                        if (command == null) {
    117                                 SendEmptyResponse (_context, HttpStatusCode.NotFound, _jsonInputData, "UNKNOWN_COMMAND");
     117                                SendEmptyResponse (_context, HttpStatusCode.NotFound, _jsonInputData, EApiErrorCode.UNKNOWN_COMMAND);
    118118                                return;
    119119                        }
     
    122122
    123123                        if (_context.PermissionLevel > commandPermissionLevel) {
    124                                 SendEmptyResponse (_context, HttpStatusCode.Forbidden, _jsonInputData, "NO_PERMISSION");
     124                                SendEmptyResponse (_context, HttpStatusCode.Forbidden, _jsonInputData, EApiErrorCode.NO_PERMISSION);
    125125                                return;
    126126                        }
Note: See TracChangeset for help on using the changeset viewer.