[syserr.errcat.objects]

# 19 Diagnostics library [[diagnostics]](./#diagnostics)

## 19.5 System error support [[syserr]](syserr#errcat.objects)

### 19.5.3 Class error_category [[syserr.errcat]](syserr.errcat#objects)

#### 19.5.3.5 Error category objects [syserr.errcat.objects]

[ð](#lib:generic_category)

`const error_category& generic_category() noexcept;
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L963)

*Returns*: A reference to an object of a type derived from class error_category[.](#1.sentence-1)

All calls to this function shall return references to the same object[.](#1.sentence-2)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L968)

*Remarks*: The object's default_error_condition and equivalent virtual functions shall behave as specified for the class error_category[.](#2.sentence-1)

The object's name virtual function shall return a pointer to the string "generic"[.](#2.sentence-2)

[ð](#lib:system_category)

`const error_category& system_category() noexcept;
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L979)

*Returns*: A reference to an object of a type derived from class error_category[.](#3.sentence-1)

All calls to this function shall return references to the same object[.](#3.sentence-2)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/diagnostics.tex#L984)

*Remarks*: The object's equivalent virtual functions shall behave as specified for
class error_category[.](#4.sentence-1)

The object's name virtual function shall return a
pointer to the string "system"[.](#4.sentence-2)

The object's default_error_condition virtual function shall behave as follows:

If the argument ev is equal to 0,
the function returns error_condition(0, generic_category())[.](#4.sentence-4)

Otherwise,
if ev corresponds to a POSIX errno value pxv,
the function returns error_condition(pxv, generic_category())[.](#4.sentence-5)

Otherwise, the function returns error_condition(ev, system_category())[.](#4.sentence-6)

What constitutes correspondence for any given operating system is unspecified[.](#4.sentence-7)

[*Note [1](#note-1)*:

The number of potential system error codes is large
and unbounded, and some might not correspond to any POSIX errno value[.](#4.sentence-8)

Thus
implementations are given latitude in determining correspondence[.](#4.sentence-9)

â *end note*]
