#include #include static const fx_error_definition ropkg_errors[] = { FX_ERROR_DEFINITION(ROPKG_SUCCESS, "SUCCESS", "Success"), FX_ERROR_DEFINITION( ROPKG_ERR_NOT_SUPPORTED, "NOT_SUPPORTED", "Operation not supported"), FX_ERROR_DEFINITION( ROPKG_ERR_INVALID_ARGUMENT, "INVALID_ARGUMENT", "Invalid argument"), FX_ERROR_DEFINITION(ROPKG_ERR_NO_MEMORY, "NO_MEMORY", "Out of memory"), FX_ERROR_DEFINITION(ROPKG_ERR_BAD_STATE, "BAD_STATE", "Bad state"), FX_ERROR_DEFINITION( ROPKG_ERR_INTERNAL_FAILURE, "INTERNAL_FAILURE", "Internal failure"), FX_ERROR_DEFINITION(ROPKG_ERR_IO_FAILURE, "IO_FAILURE", "I/O failure"), FX_ERROR_DEFINITION( ROPKG_ERR_NO_ENTRY, "NO_ENTRY", "Name does not exist"), FX_ERROR_DEFINITION(ROPKG_ERR_NO_DATA, "NO_DATA", "No data available"), FX_ERROR_DEFINITION( ROPKG_ERR_NAME_EXISTS, "NAME_EXISTS", "Name already exist"), FX_ERROR_DEFINITION_TEMPLATE( ROPKG_ERR_DIR_OPEN_FAILED, "DIR_OPEN_FAILED", "Cannot open directory @i[filepath]", FX_ERROR_TEMPLATE_PARAM( "filepath", FX_ERROR_TEMPLATE_PARAM_STRING, "%s")), FX_ERROR_DEFINITION( ROPKG_ERR_INSTANCE_LOCKED, "INSTANCE_LOCKED", "The Rosetta system root is locked. Another Rosetta package " "management tool may be running."), FX_ERROR_DEFINITION_TEMPLATE( ROPKG_ERR_INSTANCE_DIR_CREATE_FAILED, "INSTANCE_DIR_CREATE_FAILED", "Cannot create sub-directory @i[subdirpath] in instance " "@i[instancepath]", FX_ERROR_TEMPLATE_PARAM( "instancepath", FX_ERROR_TEMPLATE_PARAM_STRING, "%s"), FX_ERROR_TEMPLATE_PARAM( "subdirpath", FX_ERROR_TEMPLATE_PARAM_STRING, "%s")), FX_ERROR_DEFINITION_TEMPLATE( ROPKG_ERR_FILE_OPEN_FAILED, "FILE_OPEN_FAILED", "Cannot open file @i[filepath]", FX_ERROR_TEMPLATE_PARAM( "filepath", FX_ERROR_TEMPLATE_PARAM_STRING, "%s")), FX_ERROR_DEFINITION( ROPKG_ERR_INVALID_MANIFEST_FORMAT, "INVALID_MANIFSET_FORMAT", "Invalid manifest format"), FX_ERROR_DEFINITION( ROPKG_ERR_INVALID_VERSION_FORMAT, "INVALID_VERSION_FORMAT", "Invalid version format"), FX_ERROR_DEFINITION( ROPKG_ERR_INVALID_PKG_EXPR, "INVALID_PKG_EXPR", "Invalid package expression"), FX_ERROR_DEFINITION( ROPKG_ERR_INVALID_PKG_FILE, "INVALID_PKG_FILE", "Invalid package file"), FX_ERROR_DEFINITION( ROPKG_ERR_DB_OP_FAILED, "DB_OP_FAILED", "Database operation failed"), FX_ERROR_DEFINITION( ROPKG_ERR_NO_CHANNEL, "NO_CHANNEL", "Channel does not exist"), FX_ERROR_DEFINITION( ROPKG_ERR_NO_COMPONENT, "NO_COMPONENT", "Component does not exist"), }; static const fx_error_msg ropkg_error_msg[] = { FX_ERROR_MSG_TEMPLATE( ROPKG_EMSG_INVALID_RELEASE_PHASE, "@i[phase] is not a valid package release phase", FX_ERROR_TEMPLATE_PARAM( "phase", FX_ERROR_TEMPLATE_PARAM_STRING, "%s")), FX_ERROR_MSG( ROPKG_EMSG_AVAILABLE_RELEASE_PHASES, "valid release phases: @i{alpha}, @i{beta}"), FX_ERROR_MSG( ROPKG_EMSG_AVAILABLE_VERSION_RELEASE_PHASES, "valid version release phases: @i{alpha}, @i{beta}, @i{rc}"), FX_ERROR_MSG( ROPKG_EMSG_INVALID_UPSTREAM_VERSION_UNKNOWN_START, "unexpected character found while parsing upstream version"), FX_ERROR_MSG( ROPKG_EMSG_INVALID_UPSTREAM_VERSION_TWO_DOTS, "two consecutive full stops found in upstream version"), FX_ERROR_MSG( ROPKG_EMSG_INVALID_UPSTREAM_VERSION_END_DOT, "upstream version identifier cannot end with a full stop"), FX_ERROR_MSG( ROPKG_EMSG_INVALID_UPSTREAM_VERSION_TOO_MANY_NUMBERS, "upstream version can contain no more than five number " "components"), FX_ERROR_MSG_TEMPLATE( ROPKG_EMSG_INVALID_VERSION_RELEASE_PHASE, "@i[phase] is not a valid package version release phase", FX_ERROR_TEMPLATE_PARAM( "phase", FX_ERROR_TEMPLATE_PARAM_STRING, "%s")), FX_ERROR_MSG( ROPKG_EMSG_INVALID_VERSION_UNKNOWN_END, "unrecognised characters at the end of the version identifier"), }; static const fx_error_vendor ropkg_error_vend = { .v_name = "Ropkg", .v_error_definitions = ropkg_errors, .v_error_definitions_length = sizeof ropkg_errors, .v_msg = ropkg_error_msg, .v_msg_length = sizeof ropkg_error_msg, }; const struct fx_error_vendor *ropkg_error_vendor(void) { return &ropkg_error_vend; }