Skip to main content

StatusCode

A StatusCode represents a single entry in a Resource Status Definition Asset — the template definition for a Status. It contains the code, message template, and language information.

You typically don't create StatusCodes directly. Instead, access them through the global statusRegistry to inspect what statuses are available in your project.


At a Glance

// Browse all defined status codes for a vendor
const vendor = statusRegistry.vendors[0]; // Index 0 = internal "LAY" vendor
const codes = vendor.statusCodes;

codes.forEach(code => {
stream.logInfo(`${code.code}: ${code.message}`);
});

Properties

PropertyTypeDescription
codenumberNumeric code (e.g., 11, 42)
messagestringMessage template with placeholders (e.g., "Field '%1' is unknown")
vendorVendorThe vendor this code belongs to
// Access the internal LAY vendor's status codes
const layCodes = statusRegistry.vendors[0].statusCodes;

const code = layCodes[50];
stream.logInfo(code.code); // 251
stream.logInfo(code.message); // "merge conflict at node %1"
stream.logInfo(code.vendor.id); // 1

Accessing StatusCodes

// All vendors
const vendors = statusRegistry.vendors;

// Specific vendor by index
const layVendor = statusRegistry.vendors[0]; // Internal vendor
const myVendor = statusRegistry.vendors[1]; // Your first custom vendor

// All status codes for a vendor
const codes = myVendor.statusCodes;

// Iterate
for (const code of codes) {
stream.logInfo(`${code.code}: ${code.message}`);
}

See Also

  • Status — Runtime status instances created from these templates
  • StatusRegistry — Access all vendors and their codes
  • Vendor — Vendor information and status code collections