parser

Написать ответ на текущее сообщение

 

 
   команды управления поиском

Да, действительно глюк где-то в @unhandled_exception[]

Сухроб Хусамов 31.10.2006 21:15

Называется пытался улучшить себе жизнь:
@printExceptionSource[exception][result]
^if(def $exception.source){
	$result[<tr style="font-size:135%">
		<td valign="top"><b>Источник:</b></td>
		<td width="15px"></td>
		<td valign="top">
			^if($exception.source eq throw){
				Пустой вызов оператора ^^throw^[^].
			}{
				<pre>$exception.source</pre>
			}
		</td>
	</tr>
	<tr><td height="5px" colspan="3"></td></tr>]
}

@printExceptionComment[exception][result]
^if(def $exception.comment){
	$result[<tr>
		<td valign="top"><b>Описание:</b></td>
		<td width="15px"></td>
		<td valign="top">^untaint[html]{$exception.comment}</td>
	</tr>
	<tr><td height="5px" colspan="3"></td></tr>]
}

@printExceptionType[exception][result]
^if(def $exception.type){
	$result[<tr>
		<td valign="top"><b><nobr>Тип ошибки:</nobr></b></td>
		<td width="15px"></td>
		<td valign="top">$exception.type</td>
	</tr>]
}

@unhandled_exception_debug[exception;stack]
^fatal_error[ОШИБКА НА САЙТЕ;][
	<h1>Ошибка на сайте</h1>
	<table border="0" cellspacing="0" cellpadding="0" class="tbl">
		^printExceptionSource[$exception]
		^printExceptionComment[$exception]
		^printExceptionType[$exception]
	</table>
	^if($stack){
		<div style="overflow: auto^; height: 250px^; width: 100%">
#			<hr noshade size="1"/>
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr bgcolor="#F9CFBA" style="font-size:110%">
					<td>&#0160^;</td>
					<td valign="top" colspan="3"><tt>^spec[$exception.file]</tt></td>
					<td>&#0160^;&#0160^;&#0160^;&#0160^;</td>
					<td valign="top" align="right"><tt>$exception.lineno</tt></td>
					<td>&#0160^;&#0160^;&#0160^;&#0160^;</td>
					<td valign="top" align="right"><tt>$exception.colno</tt></td>
					<td>&#0160^;</td>
				</tr>
				^stack.menu{
					<tr bgcolor="^color[#F5F5D6;]">
						<td>&#0160^;</td>
						<td valign="top"><tt>^spec[$stack.file]</tt></td>
						<td>&#0160^;&#0160^;&#0160^;&#0160^;</td>
						<td valign="top"><tt>$stack.name</tt></td>
						<td>&#0160^;&#0160^;&#0160^;&#0160^;</td>
						<td valign="top" align="right"><tt>$stack.lineno</tt></td>
						<td>&#0160^;&#0160^;&#0160^;&#0160^;</td>
						<td valign="top" align="right"><tt>$stack.colno</tt></td>
						<td>&#0160^;</td>
					</tr>
				}
			</table>
		</div>
	}
	^if(def $form:fields){
		<h1>Поля формы</h1>
		<div style="overflow: auto^; height: 120px^; width: 100%">
			<table border="0" cellspacing="0" cellpadding="0" class="tbl">
				^form:fields.foreach[name;value]{
					<tr>
						<td valign="top"><b>$name</b></td>
						<td width="15px"></td>
						<td valign="top">= $value</td>
					</tr>
				}
			</table>
		</div>
	}
]

@spec[filespec]
$trim(^filespec.length[] - ^request:document-root.length[])
$result[^if($trim > 0){^filespec.right($trim);$filespec}]

# старый добрый color: каждый четный вызов возвращает $color1, каждый нечетный - $color2
# вызов без параметров - сброс последовательности
@color[color1;color2][c]
^if(!def $color_switcher){$color_switcher(0)}
$c[${color1}${color2}]
^if(def $c){
	$result[^if(^color_switcher.int[] % 2){$color1}{$color2}]
	^color_switcher.inc[]
}{
	$result[]
	$color_switcher(0)
}

@unhandled_exception_release[exception;stack]
^fatal_error[Ошибка на сервере;;
	<p>Ваш запрос не может быть выполнен.</p>
	<p>Свяжитесь с системным администратором $env:SERVER_ADMIN
	и проинформируйте его об ошибке.</p>
]

@unhandled_exception[exception;stack]
#use debug version to see problem details
#^unhandled_exception_release[$exception;$stack]
^unhandled_exception_debug[$exception;$stack]