private String getErrorCode(String errorShapeName) {
        ErrorTrait errorTrait = getServiceModel().getShapes().get(errorShapeName).getErrorTrait();
        if (isErrorCodeOverridden(errorTrait)) {
            return errorTrait.getErrorCode();
        } else {
            return errorShapeName;
        }
    }
The error code may be overridden for query or rest protocols via the error trait on the
exception shape. If the error code isn't overridden and for all other protocols other than
query or rest the error code should just be the shape name
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/AddExceptionShapes.java