Exception handling in Custom Login procedure
Hi,
I have a custom login procedure. Now instead of handling the possible exceptions in a custom way too, I want to use the syntax of the exception handling API (probably the one in the PDK) the default login procedure uses. Can someone point me to the values the default login procedure uses?
Thanks, Tony
Tony,
The default login page (the source of which is now unwrapped in 3.0.0), uses the following snippet of code to report the errors:
if p_error then
wwerr_api_error_ui.show_inline_html;
end if;The errors are stacked when the ls_login procedure is executed, and the next time the login page is called up, it just displays the stacked errors.
Similar Messages
-
Exception handling in custom JSF components
Hi,
Im trying to develop a JSF custom component, intended for professional use ;-)
I want to ask you for a definitive and solid way to handling exceptions in the encode/decode methods.
JSF books dont say too much about that.
For example, if your code may produce an ArrayIndexOutOfBoundsExceptions, how will you handle it? Will you use FacesException, JSFException, JSPException, ServletException, or what?
I find two interesting discussions concerning this, but I want to hear expert voices:
http://forums.sun.com/thread.jspa?forumID=427&threadID=528752
http://forums.sun.com/thread.jspa?forumID=427&threadID=528227
Thanks!You should in fact never explicitly catch RuntimeExceptions or Errors, unless you have a really, really good excuse. RuntimeExceptions are a sign of a "developer error" and needs to be bugfixed by just adding solid prechecks, so let them go. Errors are in any way unrecoverable, so let them go as well.
To avoid ArrayIndexOutOfBoundsException just add a precheck on the array length and so on. -
Exception Handling with Custom Tags/Exceptions
Hello all --
I'm looking for some guidance in handling Custom errors in my app. I can't
seem to find the message string of my custom exception when trying to call
my JSP Error page. I'm consistently getting:
javax.servlet.jsp.JspTagException: runtime failure in custom tag
'CalendarHandler' .
I am using custom JSP tag libraries to process logic on my EJBs. When I
reach an error in business logic I raise a custom exception and propogate
this back up to doStartTag:
public int doStartTag() throws JspException {
CalendarProcessor cp = new CalendarProcessor();
try {
String eventAction = getEventID();
// pageContext contains information for the JSP;
// Initialize the page with the current context and session
cp.init(pageContext.getServletContext(), pageContext.getSession());
HttpServletRequest req = (HttpServletRequest)pageContext.getRequest();
cp.processRequest(req, eventAction );
} catch (CalendarException ce) {
throw new JspException(ce.getMessage());
return SKIP_BODY;
Then, in my JSP, I am enclosing the TagHandler in a try...catch block; I
can't catch CalendarException because it is Throwable and conflicts with
JspException.
<% try { %>
<gtc:CalendarHandler eventID="updatecal"/>
<% } catch (Exception e) {
throw e instanceof JspException ? (JspException) e : new
JspTagException(e.getMessage());
%>
many thanks in advance!
s.
I could not tell what the problem was that you were describing. Could you
clarify?
Cameron Purdy
[email protected]
http://www.tangosol.com
WebLogic Consulting Available
"Shari" <[email protected]> wrote in message
news:[email protected]...
> Hello all --
>
> I'm looking for some guidance in handling Custom errors in my app. I can't
> seem to find the message string of my custom exception when trying to call
> my JSP Error page. I'm consistently getting:
> javax.servlet.jsp.JspTagException: runtime failure in custom tag
> 'CalendarHandler' .
>
> I am using custom JSP tag libraries to process logic on my EJBs. When I
> reach an error in business logic I raise a custom exception and propogate
> this back up to doStartTag:
>
> public int doStartTag() throws JspException {
>
> CalendarProcessor cp = new CalendarProcessor();
>
> try {
>
> String eventAction = getEventID();
>
> // pageContext contains information for the JSP;
>
> // Initialize the page with the current context and session
>
> cp.init(pageContext.getServletContext(), pageContext.getSession());
>
> HttpServletRequest req = (HttpServletRequest)pageContext.getRequest();
>
> cp.processRequest(req, eventAction );
>
> } catch (CalendarException ce) {
>
> throw new JspException(ce.getMessage());
>
> }
>
> return SKIP_BODY;
>
> }
>
> Then, in my JSP, I am enclosing the TagHandler in a try...catch block; I
> can't catch CalendarException because it is Throwable and conflicts with
> JspException.
>
> <% try { %>
>
> <gtc:CalendarHandler eventID="updatecal"/>
>
> <% } catch (Exception e) {
>
> throw e instanceof JspException ? (JspException) e : new
> JspTagException(e.getMessage());
>
> }
>
> %>
>
> many thanks in advance!
>
> s.
>
>
>
>
>
>
>
-
Exception handling through custom components
Please let me know if there is any info about handling exceptions using custom components?
Please share if any sample references are available.
Many Thanks.You should in fact never explicitly catch RuntimeExceptions or Errors, unless you have a really, really good excuse. RuntimeExceptions are a sign of a "developer error" and needs to be bugfixed by just adding solid prechecks, so let them go. Errors are in any way unrecoverable, so let them go as well.
To avoid ArrayIndexOutOfBoundsException just add a precheck on the array length and so on. -
Exception handling in a stored procedure
Hello,
I have a stored procedure with one IN parameter that insert values in a table as a treatment ,and i have to define an exception that raise when the same row is inserted several times (the row should be inserted one time).
do you have any idea of what is the request that should i write to do that (verify the existence of a row)??
PS : I'm just a beginner in PL/SQL
Regards,
ACok i have the following stored procedure calculer(p_duration_modifiee IN NUMBER ) that fill the table entrepot with data after a specific treatment in function of the stored procedure parameter of course.
the problem is the call of calculer(0.64) should be one time,because if we call it again with 0.64 the table entrepot will have two same raws which is not good for my application.
The question is how should raise the exception in order to have the following error message for example (row already exists,please enter a new parameter)
i wish it is more clear -
Passing Arguments to Login-Procedure
Hi,
i was trying to pass some own/more connection infos to our login procedure.
I used the "CON=" parameter.
CON=PROGRAM_USER=test_user@
PROGRAM_PASSWORD=pasword_hash@PROGRAM_CON_NAME=Test Connection
Is there a better way to pass such infos?
First I thought about the connectstring (e.g. ConnectString='DSN=myDatabase;UserDefinedOption=ABC') but i didn't find a way to access these infos in my login procedure.
How do i change the connection-name property in my login procedure?
set option name=Test Connection; -- does not work
Regards
StefanHi Stefan,
See the following sqlanywhere-forum thread for more details about changing the connection string after login - it can't be done (and really isn't intended for that purpose):
http://sqlanywhere-forum.sap.com/questions/8730/is-there-a-way-to-set-con-property-connection-apart-from-the-connection-…
So in summary, no, there isn't a way to change the connection name, and as Arcady points out, it isn't a very secure mechanism to transfer passwords. Arcady is also correct in that you should call the login procedure directly from your application.
There are two issues here:
1) Changing connection name information after login / passing information around on your connection
Instead of storing the information in the 'Name' connection property, you probably just want to use a connection-level variable or a customer user-specified database option (created by 'DBA' authority in SQL Anywhere 12 and lower or with the SET ANY USER DEFINED OPTION privilege in SQL Anywhere 16 ) to pass along information from the login procedure:
CREATE VARIABLE myVar VARCHAR(100);
SET myVar = 'Hello, World!';
SELECT myVar;
or
SET OPTION PUBLIC.custom_option = 'default'
SELECT * FROM SYS.SYSOPTION;
2) Creating a secure, custom, login procedure against another table
If you're going to be using just one database user with one set of permissions, you should look to pass the custom authentication information after the database connection has been made (hopefully over a strongly encrypted connection, for maximum security), and ideally using a prepared statement with bound parameters from the programming API you're using. Your application can then handle any SQL exceptions that are thrown from the login procedure statement and log-out the user from the application at that time.
You are correct in that this will need to be done outside of the original login procedure (that should really be verifying the supplied database username and password).
e.g. in Java:
==================
Connection con = DriverManager.getConnection( "jdbc:sqlanywhere:uid=DBA;pwd=sql" );
String sqlStr = "CALL sp_custom_login( ?, ? ) ";
// Prepare the statement
PreparedStatement stmt = con.prepareStatement( sqlStr );
// Set values
stmt.setString( 1, 'userName' );
stmt.setString( 2 'password' );
// Execute the statement
try {
int iRows = stmt.executeUpdate();
} catch (SQLException ex) {
// Can't log in - log user out of application...
ex.printStackTrace();
==================
Regards,
Jeff Albion
SAP Active Global Support -
We need to run some checks against our business rules at login
time so I have written a custom login page which calls a custom
procedure. The procedure determines how much access the user is
entitled to and sets the users group memmbership accordingly.
Finally I call the Portal login procedure with the username and
password that the user provided:
portal30.wwptl_login.login_url(USERNAME,
PASSWORD,
OK_URL,
cancel_URL);
This works ok if the user has typed in a valid username +
password. But if the Portal login fails the user gets thrown to
the Single Sign-On screen. If the user now fixes his typo and
log in again he/she bypasses the whole custom login procedure...
The only way I can think of right now is to change the Single
Sign-On screen, which I know is possible. But that will apply to
the whole Portal installation and we do need several different
custom login's, similar to the one outlined above. So we would
have to change the Single Sign-On screen just have some text
telling the user to login using one of the official login pages.
Not very nice - but a possible solution.
It would be nice if you could specify a URL to the login
procedure for the case of a failed login. Is this something that
is being concidered for future versions of Portal?
Hmmm.. in case a user bookmarks a page that is not public he/she
will still be taken to the Single Sign-On page to login. Guess
we have to change the Single Sign-On screen after all..
Any other ideas?You should develop customized login page according to the
specification provided in the SSO Server administrator guideHello
Where can i find the SSO Server administrator guide ??
Thanks
ERIC -
Custom code as an exception handler not working.
Hi,
I worked on Custom Handler for unauthorized access to a taskflow following the link below and it worked. But a special case in this doesn't work.
http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/taskflows_complex.htm#ADFFD22602
Scenario-1: I have a link that opens an unauthorized taskflow as blank page. I tried the solution of custom handler and am able to display message or display error page --- WORKS FINE
Scenario-2: I have a link that opens an unauthorized taskflow in a pop-up as blank page. The above solution doesn't work. I tried displaying SOPs but nothing gets print --- DOESN'T WORK.
Details:
The custom handler doesn't work with Pop-ups. I have an unauthorized taskflow that gets called inside a pop-up using a link. Being an unauthorized user, I click on the link and it pops-up with a blank page. As per the custom handler it is supposed to display error-page. But it doesn't.
I tried displaying SOPs inside the handleException method and nothing prints. The exception handler is unable to catch the exception. If this use-case throws some exception, my exception handler would have handle it but it doesn't raise any exception.
Is this something issue that I need to discuss with FMW team?
Any workaround for this would be of great help.
Code Sample:
public void handleException(FacesContext facesContext, Throwable throwable,
PhaseId phaseId) throws Throwable {
String errorMessage = throwable.getMessage();
if (errorMessage != null && errorMessage.indexOf("ADFC-0619") > -1) {
setEL("#{sessionScope.errorMessage}",
"You are not authorized to view this page.");
ExternalContext externalContext =
facesContext.getExternalContext();
externalContext.redirect("ErrorPage");
} else {
super.handleException(facesContext, throwable, phaseId);
Thanks
RazaHi Frank,
This scenario is not specific to a particular TaskFlow. In General, there are links in some views, that invokes taskflows and a particular user may not have permission to that TaskFlow. In this scenario, I am not sure where I need to define the method or router. And Hence I registered the Custom Exception Handler as a service as per the documentation.
But the logic in documentation doesn't work with Pop-ups.
Thanks
Raza -
Never implemented exception handling in Stored Procedures
I have lots of stand alone stored procedures callled from .NET 20 programs that follow the following pattern. They runn against Oracle 10.2 on Win2003. The only deviiation is a couple where I insert to temptables. I specify a parameter for messages but don't know the best way to implement for Oracle as well as any tips on ODP.NET/oracle interactions error handling.
1. Is it recommended to implement exception handling in With Clauses?
2. If there is an exception in one cursor's SQL, how do I still execute the second?
3. Is it best in some circumstances to pass a null back to client and check for null in program?
From .NET programs I have run into a couple of problems.
4. TNS packet failure.
Anyways any suggestions or experiences are welcome.
CREATE OR REPLACE PROCEDURE GET_SALES_DATA
, p_businessdate in date
, p_message out varchar2
, p_rcSales out sys_refcursor
, p_rInventory out sys_refcursor
) is
open p_rcSales for
with somedata as (select ...)
, someMoreData as (selct ...)
-- Main select
Select * from somedata sd inner join somemoredata smd on smd.key = sd.key;
open p_rcInventory for
with somedata as (select ...)
, someMoreData as (selct ...)
-- Main select
Select * from somedata sd inner join somemoredata smd on smd.key = sd.key;
-- CODE NOT IMPLEMENTED
-- exception
-- when TOO_MANY_ROWS then select 'Error handling for future implementations' into p_message from dual ;
-- when NO_DATA_FOUND then select 'Error handling for future implementations. No data' into p_message from dual;
-- when others then raise_application_error(-20011,'Unknown Exception in GET_SALES_DATA Function');
-- WHEN invalid_business_date then select 'Invalid: Business date is in the current work week.' into p_message from dual ;
END GET_SALES_DATA;Pseudocode'ish because Module level variables and properties have not been defined here for brevity.
Public Class WebPage1
PAge_Load
GetData
End Class Data Access Layer
Public Class DAL
Public Sub GetOracleData()
Dim conn As OracleConnection
Try
conn = New OracleConnection
Catch ex As Exception
Throw ex
End Try
Dim cmd As New OracleCommand
With cmd
conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("MyConnectionString").ToString
cmd.CommandText = DATABASE.GetSalesData
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = conn
End With
cmd.Connection = conn
Dim oparam As OracleParameter
oparam = cmd.Parameters.Add("p_businessdate", OracleDbType.Date)
oparam.Value = BusinessDate.ToString("dd-MMM-yy")
oparam = cmd.Parameters.Add("p_message", OracleDbType.Varchar2, ParameterDirection.Output)
oparam = cmd.Parameters.Add("p_rc_inven_csv", OracleDbType.RefCursor, ParameterDirection.Output)
oparam = cmd.Parameters.Add("p_rcSales", OracleDbType.RefCursor, ParameterDirection.Output)
oparam = cmd.Parameters.Add("p_rcInventory", OracleDbType.RefCursor, ParameterDirection.Output)
Dim Adapter As New OracleDataAdapter(cmd)
Try
Adapter.TableMappings.Add("Table", Sales)
Adapter.TableMappings.Add("Table1", Inventory)
Adapter.Fill(dsOracleData)
Catch ex As OracleException
HandleError("Exception Retrieving Oracle Data", ex, MethodInfo.GetCurrentMethod.Name, True)
Finally
If conn.State = ConnectionState.Open Then
conn.Close()
End If
End Try
dbMessages = cmd.Parameters("p_message").ToString
End If
arrStatusMessages.Add("Retrieved Oracle Data Successfully")
End Sub
' Original Implementation ; No longer used
Public function GetOracleData
Dim conn As New OracleConnection
conn.ConnectionString = dbconn.Connectionstring
Dim cmd As New OracleCommand
With cmd
conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("MyConnectionString").ToString
cmd.CommandText = DATABASE.GetSalesData
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = conn
End With
cmd.Connection = conn
Dim oparam As OracleParameter
oparam = cmd.Parameters.Add("p_businessdate", OracleDbType.Date)
oparam.Value = BusinessDate.ToString("dd-MMM-yy")
oparam = cmd.Parameters.Add("p_message", OracleDbType.Varchar2, ParameterDirection.Output)
oparam = cmd.Parameters.Add("p_rcSales", OracleDbType.RefCursor, ParameterDirection.Output)
oparam = cmd.Parameters.Add("p_rcInventory", OracleDbType.RefCursor, ParameterDirection.Output)
Dim Adapter As New OracleDataAdapter(cmd)
Try
Adapter.TableMappings.Add("Table", Sales)
Adapter.TableMappings.Add("Table1", Inventory)
Adapter.Fill(dsOracleData)
dim dt as datatable = dsoracledata.tables("sales")
If IsDataNull(dt) Then
_errorType = DBErrorType.NullData
End If
If isDataEmpty(dt) Then
_errorType = DBErrorType.EmptyData
End If
_hasError = False
Catch oraEx As OracleException
_ExceptionText = oraEx.Message.ToString
_errorType = DBErrorType.OracleException
#If DEBUG Then
Throw oraEx
#End If
Catch zeroEx As DivideByZeroException
_ExceptionText = zeroEx.Message.ToString
_errorType = DBErrorType.DivideByZeroException
#If DEBUG Then
Throw zeroEx
#End If
Catch oflowEx As OverflowException
_ExceptionText = oflowEx.Message.ToString
_errorType = DBErrorType.OverflowException
#If DEBUG Then
Throw oflowEx
#End If
Catch argEx As InsufficientMemoryException
_ExceptionText = argEx.Message.ToString
_errorType = DBErrorType.InsufficientMemoryException
#If DEBUG Then
Throw argEx
#End If
Catch nomemEx As OutOfMemoryException
_ExceptionText = nomemEx.Message.ToString
_errorType = DBErrorType.OutOfMemoryException
#If DEBUG Then
Throw nomemEx
#End If
Catch Ex As Exception
_ExceptionText = Ex.Message.ToString
_errorType = DBErrorType.GenericException
#If DEBUG Then
Throw Ex
#End If
Finally
If conn.State = ConnectionState.Open Then
conn.Close()
End If
End Try
End class Error Class
Public Class Errors
Public Sub ExitClass()
Return
End Sub
' 'blnWriteNow says when Error is critical and no further processing needs to be done by class, then write to event logs or text files and call exit class
' to return control back to webpage. This is my first time trying this way.
Public Sub HandleError(ByVal friendlyMsg As String, ByVal objEx As Exception, ByVal methodInfo As String, Optional ByVal blnWriteNow As Boolean = False)
If Not blnWriteNow Then Exit Sub
Dim strMessages As String
strMessages = arrStatusMessages
'Send error email
If blnSendEmails Then
SendMail("[email protected], strMessages. applicationname, " has thrown error. ")
End If
'Throw error for debugging
If blnThrowErrors Then
Throw New Exception(strMessages & vbCrLf & objEx.Message)
End If
' Write to event log and if not available (shared hosting environment), write to text log
If blnWriteNow Then
If blnWriteToEvtLog Then
If blnCanWriteToEvtLog Then 'Program has write permission to log
WriteToEventLog(strMessages, _appname, EventLogEntryType.Error, appname)
Else
If Not Directory.Exists( appPath & "\log") Then
Try
Directory.CreateDirectory( appPath & "\log")
Catch ex As Exception
arrStatusMessages.Add("Cant't write to event log or create a directory")
End Try
End If
End If
End If
End If
End Sub
End ClassI have lots of stand alone stored procedures callled from .NET 20 programs that follow the following pattern. They runn against Oracle 10.2 on Win2003. The only deviiation is a couple where I insert to temptables. I specify a parameter for messages but don't know the best way to implement for Oracle as well as any tips on ODP.NET/oracle interactions error handling.
1. Is it recommended to implement exception handling in With Clauses?
2. If there is an exception in one cursor's SQL, how do I still execute the second?
3. Is it best in some circumstances to pass a null back to client and check for null in program?
From .NET programs I have run into a couple of problems.
4. TNS packet failure.
Anyways any suggestions or experiences are welcome.
CREATE OR REPLACE PROCEDURE GET_SALES_DATA
, p_businessdate in date
, p_message out varchar2
, p_rcSales out sys_refcursor
, p_rInventory out sys_refcursor
) is
open p_rcSales for
with somedata as (select ...)
, someMoreData as (selct ...)
-- Main select
Select * from somedata sd inner join somemoredata smd on smd.key = sd.key;
open p_rcInventory for
with somedata as (select ...)
, someMoreData as (selct ...)
-- Main select
Select * from somedata sd inner join somemoredata smd on smd.key = sd.key;
-- CODE NOT IMPLEMENTED
-- exception
-- when TOO_MANY_ROWS then select 'Error handling for future implementations' into p_message from dual ;
-- when NO_DATA_FOUND then select 'Error handling for future implementations. No data' into p_message from dual;
-- when others then raise_application_error(-20011,'Unknown Exception in GET_SALES_DATA Function');
-- WHEN invalid_business_date then select 'Invalid: Business date is in the current work week.' into p_message from dual ;
END GET_SALES_DATA;Pseudocode'ish because Module level variables and properties have not been defined here for brevity.
Public Class WebPage1
PAge_Load
GetData
End Class Data Access Layer
Public Class DAL
Public Sub GetOracleData()
Dim conn As OracleConnection
Try
conn = New OracleConnection
Catch ex As Exception
Throw ex
End Try
Dim cmd As New OracleCommand
With cmd
conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("MyConnectionString").ToString
cmd.CommandText = DATABASE.GetSalesData
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = conn
End With
cmd.Connection = conn
Dim oparam As OracleParameter
oparam = cmd.Parameters.Add("p_businessdate", OracleDbType.Date)
oparam.Value = BusinessDate.ToString("dd-MMM-yy")
oparam = cmd.Parameters.Add("p_message", OracleDbType.Varchar2, ParameterDirection.Output)
oparam = cmd.Parameters.Add("p_rc_inven_csv", OracleDbType.RefCursor, ParameterDirection.Output)
oparam = cmd.Parameters.Add("p_rcSales", OracleDbType.RefCursor, ParameterDirection.Output)
oparam = cmd.Parameters.Add("p_rcInventory", OracleDbType.RefCursor, ParameterDirection.Output)
Dim Adapter As New OracleDataAdapter(cmd)
Try
Adapter.TableMappings.Add("Table", Sales)
Adapter.TableMappings.Add("Table1", Inventory)
Adapter.Fill(dsOracleData)
Catch ex As OracleException
HandleError("Exception Retrieving Oracle Data", ex, MethodInfo.GetCurrentMethod.Name, True)
Finally
If conn.State = ConnectionState.Open Then
conn.Close()
End If
End Try
dbMessages = cmd.Parameters("p_message").ToString
End If
arrStatusMessages.Add("Retrieved Oracle Data Successfully")
End Sub
' Original Implementation ; No longer used
Public function GetOracleData
Dim conn As New OracleConnection
conn.ConnectionString = dbconn.Connectionstring
Dim cmd As New OracleCommand
With cmd
conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("MyConnectionString").ToString
cmd.CommandText = DATABASE.GetSalesData
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = conn
End With
cmd.Connection = conn
Dim oparam As OracleParameter
oparam = cmd.Parameters.Add("p_businessdate", OracleDbType.Date)
oparam.Value = BusinessDate.ToString("dd-MMM-yy")
oparam = cmd.Parameters.Add("p_message", OracleDbType.Varchar2, ParameterDirection.Output)
oparam = cmd.Parameters.Add("p_rcSales", OracleDbType.RefCursor, ParameterDirection.Output)
oparam = cmd.Parameters.Add("p_rcInventory", OracleDbType.RefCursor, ParameterDirection.Output)
Dim Adapter As New OracleDataAdapter(cmd)
Try
Adapter.TableMappings.Add("Table", Sales)
Adapter.TableMappings.Add("Table1", Inventory)
Adapter.Fill(dsOracleData)
dim dt as datatable = dsoracledata.tables("sales")
If IsDataNull(dt) Then
_errorType = DBErrorType.NullData
End If
If isDataEmpty(dt) Then
_errorType = DBErrorType.EmptyData
End If
_hasError = False
Catch oraEx As OracleException
_ExceptionText = oraEx.Message.ToString
_errorType = DBErrorType.OracleException
#If DEBUG Then
Throw oraEx
#End If
Catch zeroEx As DivideByZeroException
_ExceptionText = zeroEx.Message.ToString
_errorType = DBErrorType.DivideByZeroException
#If DEBUG Then
Throw zeroEx
#End If
Catch oflowEx As OverflowException
_ExceptionText = oflowEx.Message.ToString
_errorType = DBErrorType.OverflowException
#If DEBUG Then
Throw oflowEx
#End If
Catch argEx As InsufficientMemoryException
_ExceptionText = argEx.Message.ToString
_errorType = DBErrorType.InsufficientMemoryException
#If DEBUG Then
Throw argEx
#End If
Catch nomemEx As OutOfMemoryException
_ExceptionText = nomemEx.Message.ToString
_errorType = DBErrorType.OutOfMemoryException
#If DEBUG Then
Throw nomemEx
#End If
Catch Ex As Exception
_ExceptionText = Ex.Message.ToString
_errorType = DBErrorType.GenericException
#If DEBUG Then
Throw Ex
#End If
Finally
If conn.State = ConnectionState.Open Then
conn.Close()
End If
End Try
End class Error Class
Public Class Errors
Public Sub ExitClass()
Return
End Sub
' 'blnWriteNow says when Error is critical and no further processing needs to be done by class, then write to event logs or text files and call exit class
' to return control back to webpage. This is my first time trying this way.
Public Sub HandleError(ByVal friendlyMsg As String, ByVal objEx As Exception, ByVal methodInfo As String, Optional ByVal blnWriteNow As Boolean = False)
If Not blnWriteNow Then Exit Sub
Dim strMessages As String
strMessages = arrStatusMessages
'Send error email
If blnSendEmails Then
SendMail("[email protected], strMessages. applicationname, " has thrown error. ")
End If
'Throw error for debugging
If blnThrowErrors Then
Throw New Exception(strMessages & vbCrLf & objEx.Message)
End If
' Write to event log and if not available (shared hosting environment), write to text log
If blnWriteNow Then
If blnWriteToEvtLog Then
If blnCanWriteToEvtLog Then 'Program has write permission to log
WriteToEventLog(strMessages, _appname, EventLogEntryType.Error, appname)
Else
If Not Directory.Exists( appPath & "\log") Then
Try
Directory.CreateDirectory( appPath & "\log")
Catch ex As Exception
arrStatusMessages.Add("Cant't write to event log or create a directory")
End Try
End If
End If
End If
End If
End Sub
End Class -
Implementing Exception Handling Application Block in custom web parts, event receivers
hi,
I am currently implementing try {} catch(Exception expp) { throw expp;} to handle exceptions in my intranet appln.
I have several custom web parts, event receivers, few console applciations as timer jobs etc. If i want to implement a robust exception handling what should be the approach. by searching, i saw, ms patterns n practices provides the
appln blocks.
But I think[ pls correct me if i am wrong ] those appln blocks are meant for asp.net applns ONLY.
if not, anyone has implemented those appln blocks in SP development? if yes, can anyone provide one sample / link to implement Exception Handling in SP.
help is appreciated!Hi,
Here are some articles for your reference:
Handling Error Centrally in a SharePoint Application
http://www.codeproject.com/Articles/26236/Handling-Error-Centrally-in-a-SharePoint-Applicati
Using Microsoft Enterprise Library Application Block in SharePoint
http://www.codeproject.com/Articles/21389/Using-Microsoft-Enterprise-Library-Application-Blo
Exception Handling in SharePoint
http://spmatt.wordpress.com/2012/02/01/exception-handling-in-sharepoint/
Best Regards
Dennis Guo
TechNet Community Support -
Resume procedure execution after Exception Handler
Hi -- Can anyone tell me how to resume execution of my procedure if and when I fall into the Exception Handler?
I'm in a for/loop and i want to move to the next record after falling into the exception handler.
Thanks,
~ChristineIt's just a scoping issue...
BEGIN
FOR r IN ( SELECT ... FROM whatever ) LOOP
BEGIN
-- do stuff
EXCEPTION
WHEN others THEN
log_error(SQLERRM);
END;
END LOOP;
END;
/If you're using BULK processing you may want to check out %BULK_EXCEPTIONS.
Cheers, APC -
Exception handling in calling procedure
Hi,
i have a package where currently am making calls to private procedures from public procedure.
and the senario is:-
create package body p_tst
is
ex_failed exception;
-- this is private proc
procedure p_private
is
begin
raise ex_failed;
exception
when ex_failed
then
raise;
end p_private;
procedure p_public
is
begin
-- nomaking call to private
-- procedure
p_private;
-- here i need to catch
-- the raised exception
-- passed from the called
-- procedure
when ex_failed
end p_public;
end;
basically i want to catch the exception being passed from called procedure to calling procedure, and raise the same exception in calling procdure.
is it possible to catch the same exception in the calling procedure?Yes, you can catch the same exception in the calling procedure, exceptions are propagated to the caller if they are not handled in the called procedure.
Is this what you are trying to do?
CREATE OR REPLACE PACKAGE p_tst
AS
PROCEDURE p_public;
ex_failed EXCEPTION;
END;
CREATE OR REPLACE PACKAGE BODY p_tst
IS
PROCEDURE p_private
IS
BEGIN
RAISE ex_failed;
END p_private;
PROCEDURE p_public
IS
BEGIN
p_private;
EXCEPTION
WHEN ex_failed
THEN
DBMS_OUTPUT.put_line ('error');
END p_public;
END;
SQL> set serveroutput on;
SQL> exec p_tst.p_public;
error
PL/SQL procedure successfully completed. -
How to handle ADF_FACES Errors/Exceptions and display customized message.
Hi All,
<b>My question here is, </b>
Is there any way to handle the validation/PPR kind of run time exceptions/errors. I have tried to handle these errors by extending the lifecycle and overridden the reportErrors method. But this method is being called in the PREPARE_RENDER phase. But the exception is happening in the JSF_PROCESS_VALIDATIONS phase. I have tried to handle the exceptions in the custom PagePhaseListener. But these exceptions could not be handled in the custom PagePhaseListener.
<b>I would like to display a customized message to the user instead of displaying the PPR exception</b>.
The details are given below.
I have a use case related to the security like if there is a drop down list in a page. Drop down list is having a af:validateRegExp component which allows only alphabets. Dropdown is populating alphanumeric values.
One option is selected in the drop down list and submitted the value with the help of the commondbutton.
With the help of some tools, we modified the submitted value(index of the list submitted) to some alphabets.
<b>Its throwing some validation exception. Some of the statements are given below.</b>
<UIXRegion> <_warn> Error processing viewId: /Validate_TF/validate URI: /validate.jsff actual-URI: /validate.jsff.
java.lang.NumberFormatException: ADF_FACES-60034:SelectOne could not convert index 0asd
<LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase PROCESS_VALIDATIONS 3
<RegistrationConfigurator> <handleError> ADF_FACES-60096:Server Exception during PPR
<b>displaying a popup dialog with error message like:</b>
ADF_FACES_60034:could not convert index
ADF_FACES_60097:server exception
ADF_FACES_60096: some exception occurred during PPR,
<b>I don't want to show these kind of messages to user. Please suggest me whether is it possible or not.</b>
Thanks in advance.
Regards,
SatishRaj Dasari.Hi,
Try reading one of Franks post :
[url https://blogs.oracle.com/jdevotnharvest/entry/extending_the_adf_controller_exception_handler]
Nigel -
Hi,
Is there any posibility to add custom exception handler to EDT? I'm thinking to implement an automatic feed-back from a client aplication. When an exception occurs in EDT it will automatically send to server. The problem is that unsigned webstart application have no permissions to call Thread.setUncaughtExceptionHandler() on EDT.
Is there any workaround?
AntonHi,
Is there any posibility to add custom exception handler to EDT? I'm thinking to implement an automatic feed-back from a client aplication. When an exception occurs in EDT it will automatically send to server. The problem is that unsigned webstart application have no permissions to call Thread.setUncaughtExceptionHandler() on EDT.
Is there any workaround?
Anton -
Problems with Custom Exception Handler
Hi,
I have defined a custom exception handler for my workflow (WebLogic Platform
7).
I have a workflow variable called 'count' , which gets incremented for every
time an exception occurs.
The exception handler checks if the count is less than 3(using evaluate
condition),
if yes then it executes the action "Exit Execption Handler and retry"
else
it executes the action "Exit Execption Handler and continue"
The Workflow simply hangs, nothing on the console , the worklist from which
i call it hangs too.
Has anyone managed to use this kind of exception handling?
Thanks in advance,
Asifbill0 wrote:
> Thanks for all the help but still no luck.
>
> The directory is d:\wSites\GBMain\html\CFMS> and I am
mapped to it as x:\CFMS.
> Most of the cfm files are in CFMS but Application.cfm is
1 directory up in
> html. I have tried misscfm.cfm in both html and CFMS but
had no luck having it
> find a non existant template referred to in a cfinclude
or a form's action
> attribute. The default ColdFusion error handler is what
shows. The missing
> template handler box says /misscfm.cfm. Misscfm.cfm is
text followed by a
> <cfabort>. We use ColdFusion MX6.1
>
> I hope that is enough information to figure what am I
missing and/or doing
> wrong.
>
>
Is the 'misscfm.cfm' file somewhere in the
'd:\wSites\GBMain\html\CFMS\'
directory. I will presume this is the 'web root' as defined
in your web
server (IIS or Apache or built-in or ???). The missing
template handler
file needs to be in the ColdFusion root. This is going to be
a
directory such as
'{drive}:\JRun4\servers\{server}\cfusion-ear\cfusion-war\misscfm.cfm'
for J2EE flavors OR '{drive}:\CFusionMX\wwwroot' for Standard
I think.
It has been a very long time since I have dealt with
Standard.
This is probably completely different from the above web
root. That is
the point I am trying to get across. ColdFusion has TWO roots
where it
will look for a CFML file. But the Missing and Sitewide
templates can
only be in the ColdFusion root listed above, they will not
work in the
web root.
HTH
Ian
Maybe you are looking for
-
Close Open Amount on A/P Down Payment Invoice
Hi, I have the following scenario: I have created an A/P down payment invoice for 1000$ Create an Outgoing Payment for this A/P Down Payment Invoice for 1000$ This payment is closing the A/P Down Payment invoice Create an A/P Invoice for 800$ - apply
-
Service Desk message forwarding to Central System
HI All, We have a requirement as below. There a total of 5 different customer landscape, each with a solution manager . Each customer raising tickets to thier own solution manager . The requirement is from each of those service desks, the tickets and
-
Why wont my dane cook cd play on my ipod?
all my cd's have gone onto my ipod easily. when i tryed to put this one from itunes (it played fine there) to ipod, it said this cd can not be plays on this ipod. i have changed the type to mp3 and others, but it still wont work help
-
How to add inputfield dynamically
Hi, How to add Textfield and inputfield dynamically when i select Radio button in webdynpro-abap. Can any one give example code of this requirement. Thanks Neelima
-
Hi. This is ranganadh, i am generating very simple report, but under laying it has very huge table and lot of joins .. but i have a proper indexing to get results much faster .. i have taken new report, and given oracle command for data source, i wa