Zbudowałem to wyrażenie przy http://regextester.com, aby parsować YSOD, ale VS narzeka na błąd składni. Jestem pewna, że brakuje mi gdzieś ucieczki, ale jestem pusta.YSOD Żółty ekran śmierci JavaScript RegExp - Błąd składni
Tutaj jest w oryginalnej formie. każda pomoc jest doceniana.
var rxYSOD = /<!--\s*\[(.*?)]:(\s*.*\s(.*\n)*?)\s*(at(.*\n)*)-->/gs;
UPDATE: Kobi wskazał oczywiste i got me znowu rusza. Dla tych, którzy są zainteresowani, jest to poprawny skrypt JavaScript do testowania i analizowania XMLHttpRequest.responseText dla Yellow Screen Of Death (YSOD) ASP.net.
var rxYSOD = /<!--\s*\[(.*?)]:(\s*.*\s(.*[\n\r]*)*?)\s*(at(.*[\n\r]*)*)-->/;
if (rxYSOD.test(text)) {
// looks like one..
var ysod = rxYSOD.exec(text);
errObj = { Message: ysod[2], StackTrace: ysod[4], ExceptionType: ysod[1] };
}
@Kobi - Wynika to a powodem chcę analizować html chociaż dostaję 500:
{
"message": " Unknown web method ValidateUser.\r\nParameter name: methodName\r\n",
"stackTrace": "at System.Web.Script.Services.WebServiceData.GetMethodData(String methodName)\r\n at System.Web.Script.Services.RestHandler.CreateHandler(WebServiceData webServiceData, String methodName)\r\n at System.Web.Script.Services.RestHandler.CreateHandler(HttpContext context)\r\n at System.Web.Script.Services.RestHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)\r\n at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)\r\n at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)\r\n at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()\r\n at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)\r\n",
"exceptionType": "ArgumentException",
"errorObject": {
"Message": " Unknown web method ValidateUser.\r\nParameter name: methodName\r\n",
"StackTrace": "at System.Web.Script.Services.WebServiceData.GetMethodData(String methodName)\r\n at System.Web.Script.Services.RestHandler.CreateHandler(WebServiceData webServiceData, String methodName)\r\n at System.Web.Script.Services.RestHandler.CreateHandler(HttpContext context)\r\n at System.Web.Script.Services.RestHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)\r\n at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)\r\n at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)\r\n at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()\r\n at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)\r\n",
"ExceptionType": "ArgumentException"
},
"statusCode": 500,
"servicePath": "/Authentication_JSON_AppService.axd",
"useGet": false,
"params": {
"username": "testingUser",
"password": "testingUser",
"customCredential": null
},
"methodName": "ValidateUser",
"__typeName": "Salient.ScriptModel.WebServiceError"
}
Czy nie otrzymasz również kodu statusu "500 Wewnętrzny błąd serwera" dla tych ekranów? Mimo wszystko, powodzenia! – Kobi
@Kobi, tak, z pewnością. właśnie dlatego analizuję stronę, ponieważ ma faktyczny wyjątek. Nic, co gorsze, nie jest gorsze, to wiadomość typu catch all exception, gdy informacja jest rzeczywiście dostępna. –