error handling in asp

0

Request your help to be able to handle errors of this type, so that it does not display information that can be used in a bad way, that is, I would like to know how I can make that when these types of errors appear, a more personalized error message is left, eg " error in the query, or nose "

I request your help to be able to handle errors of this type, so that it does not display information that can be used in a bad way, that is, I would like to know how I can make that when these types of errors appear, an error message is left. custom, eg "error in the query", for pages 4xx and 5xx

    
asked by Juan Manosalva 19.07.2017 в 20:45
source

2 answers

0

you can use this code:

try{
//codigo...
}catch (Exception $e){
echo 'se ha producido un error: '.$e->getMessage();
//si no quieres mostrar el error
echo 'se ha producido un error.';
}
    
answered by 19.07.2017 в 20:58
0

As I see in your code, you are using classic asp, which, for error handling, you should use "On Error Resume Next"

I'll give you an example:

<%
On Error Resume Next
'AQUÍ IRÍA EL CÓDIGO SUSCEPTIBLE DE QUE SE PRODUZCA UN ERROR
'Si se produce un error  
If err.Number <> 0 Then 
Response.Write "Código de error = " & err.Number & "; descripción del error = " & err.Description   'mostramos en pantalla el código de error  y descripción
End If
%>

I hope it serves you.

    
answered by 21.12.2018 в 08:19