org.appcelerator.kroll
Interface KrollExceptionHandler

All Known Implementing Classes:
TiExceptionHandler

public interface KrollExceptionHandler

An interface for handling exceptions from the runtime.

A KrollExceptionHandler can be registered to the runtime by calling KrollRuntime.setPrimaryExceptionHandler(KrollExceptionHandler) or KrollRuntime.addAdditionalExceptionHandler(KrollExceptionHandler, String).
A handler can either be added as a primary or an additional handler. There can only be one primary handler, while multiple additional handlers can be set.
When an exception occurs, all of the additional handlers are called first, and the primary handler will be called last.
By default, the primary handler will be set to a TiExceptionHandler that pops up an error dialog.

An example of performing additional tasks before the default error dialog:

        KrollExceptionHandler handler = new KrollExceptionHandler() {   
                @Override
                public void handleException(ExceptionMessage arg0) {
                        // perform additional tasks here
                }
        };
        KrollRuntime.addAdditionalExceptionHandler(handler, "sampleTask");
 
To override the default error dialog behavior, simply override the primary handler with a custom handler.


Nested Class Summary
static class KrollExceptionHandler.ExceptionMessage
           
 
Method Summary
 void handleException(KrollExceptionHandler.ExceptionMessage e)
          Handles the exception
 

Method Detail

handleException

void handleException(KrollExceptionHandler.ExceptionMessage e)
Handles the exception

Parameters:
e - An exception message containing line number, error title, message, etc


Copyright © 2010-2012 Appcelerator, Inc. Licensed under the Apache License 2.0