public static ErrorJt jtExceptionOld(this Exception ex) { int index = ex.StackTrace.LastIndexOf("at "); string msgFull = (index < 0 ? "" : ex.StackTrace.Substring(index + 3)); ErrorJt regreso = new ErrorJt { msg = ex.Message, trace = ex.StackTrace.Trim() //ex.StackTrace.Trim() }; //string miError = ex.Message + " - " + msgFull; return(regreso); }
public static ErrorJt jtException(this Exception ex) { string msgEx = ex.ToString(); string interna = ex.StackTrace; int indice = ex.StackTrace.IndexOf("at Microsoft.AspNetCore."); string msgFull = (indice < 0 ? ex.StackTrace : ex.StackTrace.Left(indice)); ErrorJt regreso = new ErrorJt { msg = ex.Message, trace = msgFull.Trim() }; return(regreso); }