public ApiResponse GetExceptionRelated([FromRoute] string id) { try { var ex = ExceptionLogger.GetException(id); if (ex == null) { return(ApiResponse.ExclamationModal($"An exception with id \"{id}\" could not be found.")); } var ret = (from exception in ex.related select new { id = exception.sId, exception.created, message = exception.message.Left(200, true), // limit exception message length to something reasonable exception.procedure, exception.appTitle, exception.appVersion, relatedCount = exception.related?.Count ?? 0 } ); return(ApiResponse.Payload(ret)); } catch (Exception ex) { return(ApiResponse.Exception(ex)); } }
public ApiResponse GetException([FromRoute] string id, [FromQuery(Name = "parent")] string parentId) { try { ExceptionWrapper ret = null; if (!string.IsNullOrWhiteSpace(parentId)) { var parent = ExceptionLogger.GetException(parentId); if (parent == null) { return(ApiResponse.ExclamationModal($"A parent exception with id \"{parentId}\" could not be found.")); } var child = parent.GetRelated(id); if (child == null) { return(ApiResponse.ExclamationModal($"An exception with id \"{id}\" could not be found.")); } ret = child; } else { var ex = ExceptionLogger.GetException(id); if (ex == null) { ex = ExceptionLogger.DeepFindRelated(id); } if (ex == null) { return(ApiResponse.ExclamationModal($"An exception with id \"{id}\" could not be found.")); } ret = ex; } return(ApiResponse.Payload(new { ret.appTitle, ret.appVersion, ret.created, ret.errorCode, ret.execOptions, id = ret.sId, ret.innerException, ret.level, ret.line, ret.message, ret.procedure, ret.server, //?ret.sqlErrorType, ret.stackTrace, ret.state, ret.type, ret.additionalInfo })); } catch (Exception ex) { SessionLog.Exception(ex); return(ApiResponse.Exception(ex)); } }