Skip to content

MqttException v3 does not have error code in its message #1090

Description

@scrat98

There’s an issue where, if no human readable message can be found for an error code, we only get "MqttException" without the actual error code. Implementation details:

  1. Not all languages have mappings from error codes to messages.
  2. Even in English, some codes are missing, for example, error code 128 (SUBSCRIBE_FAILED) has no mapping: https://github.com/eclipse-paho/paho.mqtt.java/blob/master/org.eclipse.paho.client.mqttv3/src/main/resources/org/eclipse/paho/client/mqttv3/internal/nls/messages.properties
    public static void main(String[] args) {
        MqttException error = new MqttException(REASON_CODE_SUBSCRIBE_FAILED);
        System.out.println(error.getMessage()); // just MqttException
    }

It's especially painful during logging, since we may get just "MqttException" without any cause, because broker replied with REASON_CODE_SUBSCRIBE_FAILED, for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions