static ChannelError fromSigError(int flag, int ctype, ByteBuffer data) {
        String message = "";

        message = "Bad signal";

        if (ctype == ContentType.UTF8 && data != null) {

            Charset charset = Charset.forName("UTF-8");
            CharsetDecoder decoder = charset.newDecoder();
            int pos = data.position();

            try {
                message = decoder.decode(data).toString();
            } catch (CharacterCodingException ex) {
            } finally {
                data.position(pos);
            }
        }

        return new ChannelError(message);
    }