Every error and warning raised by the package carries a class that can
be caught with tryCatch() or silenced with suppressWarnings()
selectively, and a set of fields describing the request that produced
it. All classes inherit from tidybrreg_error or tidybrreg_warning.
Errors
tidybrreg_error_invalid_org_nr: the organization number failedbrreg_validate(). Fieldorg_nr.tidybrreg_error_invalid_filter: a filter is not supported by the requested registry (for examplebankruptonunderenheter). Fieldsregistry,filter.tidybrreg_error_not_found: the endpoint answered HTTP 404 for an organization number. Fieldsorg_nr,endpoint,status.tidybrreg_error_http: any other HTTP status of 400 or above, or a failure on the first page of a paginated request. Fieldsendpoint,status,messages(as extracted from the BRREG error body). 429, 503, 500, 502 and 504 are retried up to three times first (except the Regnskapsregisteret 500 for an unsupported accounting plan, which is final).tidybrreg_error_rate_limited: the register answered its rate limit as HTTP 200 with the textToo many requestson every retry. Fieldsurl,status(200),attempts.tidybrreg_error_connection: the host could not be reached (DNS, TCP, TLS or a dropped connection) on every retry. Fieldsurl,attempts.tidybrreg_error_result_window: the query matches more entities than BRREG's search window can deliver and the request asked for more than the window. Fieldsendpoint,total_matches,retrieval_limit,filters. Seebrreg_search().
Warnings
tidybrreg_warning_deleted: the entity has been deleted from the register (HTTP 410, or HTTP 200 withrespons_klasse"SlettetEnhet"). Fieldsorg_nr,deletion_date.tidybrreg_warning_partial: a paginated request failed after at least one page was retrieved; the partial result is returned with attributecomplete = FALSE. Fieldsendpoint,status,pages_fetched.tidybrreg_warning_truncated: more results exist than were returned because ofmax_resultsormax_pages; the result carries attributecomplete = FALSE. Fieldsendpoint,returned,total_matches.tidybrreg_warning_unknown_member: an update feed carried a member the package does not model; it is passed through unchanged. Fieldmembers.tidybrreg_warning_bundled_fallback: SSB KLASS was unreachable and a bundled dictionary was used instead. Fieldsdictname,vintage.tidybrreg_warning_unresolved: the Fullmakt service answered HTTP 200 but declined to resolve the signature or procuration rule mechanically (status.rutineStatus); the typed empty result carrieshttp_status = 200L,routine_statusandroutine_text. Fieldsorg_nr,signature_type,routine_status,routine_text. Seebrreg_signatur().tidybrreg_warning_unsupported_plan: Regnskapsregisteret does not serve the entity's accounting plan (banks, insurers, pension funds); the typed empty result carrieshttp_status = 500Landunsupported_plan. Fieldsorg_nr,plan,api_message. Seebrreg_regnskap().tidybrreg_warning_parse: values could not be coerced to the type declared in field_dict; the result carries attributebrreg_parse_problems. Fieldn.
See also
Other tidybrreg utilities:
brreg_label(),
brreg_validate(),
get_brreg_dic(),
tidybrreg_endpoints
Examples
tryCatch(
brreg_entity("123456789"),
tidybrreg_error_invalid_org_nr = function(e) e$org_nr
)
#> [1] "123456789"