dev@grizzly.java.net

how throw/return exception in a ProtocolParser ?

From: Survivant 00 <survivant00_at_gmail.com>
Date: Fri, 14 Nov 2008 08:32:03 -0500

In ym ProtocolParser in

 public boolean hasNextMessage() { ... }


I'm decoding the query received.

try {
                ByteBuffer tmp = processingBuffer.duplicate();
                msg = f_asciiDecoder.decode(tmp).toString();
            } catch (CharacterCodingException e) {
                s_logger.error("Error decoding query",e);
                return false;
            }

if I catch a exception, I would like to return a message to the client :
"Error processing the query..." (I could be any kind of exceptions)

how can I do that ?

I could return a message in

public String getNextMessage() {

        if(s_logger.isDebugEnabled()){
            s_logger.debug("getNextMessage");
        }

        if(exception){
            return "Error processing the query...";
        }
        return query;
    }

but if I do that (and I don't like it), I will have to test each query
return.