error

fun error(code: CoapCode, diagnostic: String? = null): CoapResponse(source)

An error response; diagnostic becomes the RFC 7252 §5.5.2 diagnostic payload, which is UTF-8 text for developers and SHOULD be empty when it adds nothing to the code.