public ErrorCode(ErrorServiceCode service, ErrorFuncAreaCode funcArea, ErrorOperation error, ErrorSubcode errorSubCode) { _serviceCodePart = (byte)service; _funcAreaPart = (ushort)funcArea; _errorOpPart = (ushort)error; _errorSubcode = (ushort)errorSubCode; }
public ErrorCode(ErrorType type, ErrorModule module, ErrorOperation operation, ErrorScope scope) { Family = (ErrorFamily)Enum.ToObject(typeof(ErrorFamily), (int)type / 1000); Type = ErrorType.Unknown; Module = module; Operation = operation; Scope = scope; Entity = ErrorEntity.None; long shift = 1; Code = (long)scope + (long)operation * (shift *= 100000) + (long)module * (shift *= 1000) + (long)type * (shift * 100); Name = $"{type}{module}{operation}{scope}"; }
public ErrorCode(ErrorFamily family, ErrorModule module, ErrorOperation operation, ErrorScope scope) { Family = family; Type = ErrorType.Unknown; Module = module; Operation = operation; Scope = scope; Entity = ErrorEntity.None; long shift = 1; Code = (long)scope + (long)operation * (shift *= 100000) + (long)module * (shift *= 1000) + (long)family * (shift * 100000); Name = $"{family}{module}{operation}{scope}"; }
public ErrorCode(ErrorFamily family, ErrorModule module, ErrorOperation operation, ErrorEntity entity) { Family = family; Type = ErrorType.Unknown; Module = module; Operation = operation; Scope = (ErrorScope)Enum.ToObject(typeof(ErrorScope), (int)entity / 1000); Entity = entity; long shift = 1; Code = (long)entity + (long)operation * (shift *= 100000) + (long)module * (shift *= 1000) + (long)family * (shift * 100); Name = $"{family}{module}{operation}{entity}"; }
public ErrorCode(ErrorType type, ErrorModule module, ErrorOperation operation, ErrorEntity entity) { Family = (ErrorFamily)Enum.ToObject(typeof(ErrorFamily), (int)type / 1000); Type = type; Module = module; Operation = operation; Scope = (ErrorScope)Enum.ToObject(typeof(ErrorScope), (int)entity / 1000); Entity = entity; long shift = 1; Code = (long)entity + (long)operation * (shift *= 100000) + (long)module * (shift *= 1000) + (long)type * (shift * 100); Name = $"{type}{module}{operation}{entity}"; }
public DotChatNotFoundUserException(ErrorModule module, ErrorOperation operation, Guid?chatId, Guid?userId, Exception innerException = null) : base(new ErrorInfo(new ErrorCode(ErrorType.NotFound, module, operation, ErrorEntity.User), $"User {chatId} not found", chatId, userId, null), innerException) { }