private Map<String, ShapeModel> constructExceptionShapes() {
        // Java shape models, to be constructed
        final Map<String, ShapeModel> javaShapes = new HashMap<String, ShapeModel>();

        for (Map.Entry<String, Operation> entry : getServiceModel().getOperations().entrySet()) {

            Operation operation = entry.getValue();
            List<ErrorMap> operationErrors = operation.getErrors();

            if (operationErrors != null) {
                for (ErrorMap error : operationErrors) {

                    String errorShapeName = error.getShape();
                    String javaClassName = getNamingStrategy().getExceptionName(errorShapeName);

                    ShapeModel exceptionShapeModel = generateShapeModel(javaClassName,
                                                                        errorShapeName);

                    exceptionShapeModel.setType(ShapeType.Exception.getValue());
                    exceptionShapeModel.setErrorCode(getErrorCode(errorShapeName));
                    if (exceptionShapeModel.getDocumentation() == null) {
                        exceptionShapeModel.setDocumentation(error.getDocumentation());
                    }

                    javaShapes.put(javaClassName, exceptionShapeModel);
                }
            }
        }

        return javaShapes;
    }
Constructs the exception shapes for the intermediate model. Analyzes the operations in the
service model to identify the exception shapes that are to be generated.
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/AddExceptionShapes.java