« Quit Carping | Main | MT: It just works (and it's in Perl) »

Cameron Purdy on Lexing and exception wrapping

/dev/null [Cameron]

Instead of:

        catch (EOFException e)
            {
            logError(ERROR, ERR_UNEXPECTED_EOF, null,
                    m_script.getLine(), m_script.getOffset(), 0);
            throw new CompilerException();
            }
        catch (UnicodeDataFormatException e)
            {
            logError(ERROR, ERR_UNICODE_ESCAPE, null,
                    m_script.getLine(), m_script.getOffset(), 0);
            throw new CompilerException();
            }
        catch (IOException e)
            {
            logError(ERROR, ERR_UNEXPECTED_IO, new String[] {e.toString()},
                    m_script.getLine(), m_script.getOffset(), 0);
            throw new CompilerException();
            }

How about:

        catch (EOFException e)
            {
            logError(ERROR, ERR_UNEXPECTED_EOF, null,
                    m_script.getLine(), m_script.getOffset(), 0);
            throw new CompilerException(e);
            }
        catch (UnicodeDataFormatException e)
            {
            logError(ERROR, ERR_UNICODE_ESCAPE, null,
                    m_script.getLine(), m_script.getOffset(), 0);
            throw new CompilerException(e);
            }
        catch (IOException e)
            {
            logError(ERROR, ERR_UNEXPECTED_IO, new String[] {e.toString()},
                    m_script.getLine(), m_script.getOffset(), 0);
            throw new CompilerException(e);
            }

February 19, 2003 11:58 PM

Comments

Trackback Pings

TrackBack URL for this entry:
http://www.dehora.net/mt/mt-tb.cgi/925