@SuppressWarnings("unchecked")
    private void createErrorFile(Watcher watcher, WatchingException e) {
        mojo.getLog().debug("Creating error file for '" + e.getMessage() + "' happening at " + e.getLine() + ":" + e
                .getCharacter() + " of " + e.getFile() + ", created by watcher : " + watcher);
        JSONObject obj = new JSONObject();
        obj.put("message", e.getMessage());
        if (watcher instanceof WatcherDelegate) {
            obj.put("watcher", ((WatcherDelegate) watcher).getDelegate().getClass().getName());
        } else {
            obj.put("watcher", watcher.getClass().getName());
        }
        if (e.getFile() != null) {
            obj.put("file", e.getFile().getAbsolutePath());
        }
        if (e.getLine() != -1) {
            obj.put("line", e.getLine());
        }
        if (e.getCharacter() != -1) {
            obj.put("character", e.getCharacter());
        }
        if (e.getCause() != null) {
            obj.put("cause", e.getCause().getMessage());
        }
        if (e.getTitle() != null) {
            obj.put("title", e.getTitle());
        }
        try {
            FileUtils.writeStringToFile(getErrorFileForWatcher(watcher), obj.toJSONString(), false);
        } catch (IOException e1) {
            mojo.getLog().error("Cannot write the error file", e1);
        }
    }
@ SuppressWarnings ( "unchecked" ) private void createErrorFile ( Watcher watcher , WatchingException e ) { mojo . getLog ( ) . debug ( "Creating error file for '" + e . getMessage ( ) + "' happening at " + e . getLine ( ) + ":" + e . getCharacter ( ) + " of " + e . getFile ( ) + ", created by watcher : " + watcher ) ; JSONObject obj = new JSONObject ( ) ; obj . put ( "message" , e . getMessage ( ) ) ; if ( watcher instanceof WatcherDelegate ) { obj . put ( "watcher" , ( ( WatcherDelegate ) watcher ) . getDelegate ( ) . getClass ( ) . getName ( ) ) ; } else { obj . put ( "watcher" , watcher . getClass ( ) . getName ( ) ) ; } if ( e . getFile ( ) != null ) { obj . put ( "file" , e . getFile ( ) . getAbsolutePath ( ) ) ; } if ( e . getLine ( ) != - 1 ) { obj . put ( "line" , e . getLine ( ) ) ; } if ( e . getCharacter ( ) != - 1 ) { obj . put ( "character" , e . getCharacter ( ) ) ; } if ( e . getCause ( ) != null ) { obj . put ( "cause" , e . getCause ( ) . getMessage ( ) ) ; } if ( e . getTitle ( ) != null ) { obj . put ( "title" , e . getTitle ( ) ) ; } try { FileUtils . writeStringToFile ( getErrorFileForWatcher ( watcher ) , obj . toJSONString ( ) , false ) ; } catch ( IOException e1 ) { mojo . getLog ( ) . error ( "Cannot write the error file" , e1 ) ; } }
Creates the error file storing the information from the given exception in JSON. This file is consumed by the
Wisdom server to generate an error page reporting the watching exception.

@param watcher the watcher having thrown the exception
@param e       the exception