Vostok.Configuration
HomeQuickstartConcepts and basicsBasic scenarios
  • Home
  • Quickstart
  • Concepts and basics
    • Settings nodes
      • Value nodes
      • Array nodes
      • Object nodes
    • Settings nodes merging
    • Settings nodes scoping
    • Binding nodes to models
    • Configuration sources
    • Configuration provider
    • Caching and performance
    • Error handling
  • Modules
    • Abstractions
    • Configuration
    • Sources
    • Sources.CC
    • Sources.Json
    • Sources.Yaml
    • Sources.Xml
    • Sources.Vault
    • Logging
    • Microsoft
  • Sources
    • Constant sources
    • Object source
    • XML sources
    • YAML sources
    • JSON sources
    • Vault source
    • ClusterConfig source
    • Command line source
    • Environment variables source
  • Binders
    • Primitives
    • Collections
    • Classes and structs
    • Constructor injection
  • Basic scenarios
    • Assign sources to types
    • Obtain settings from provider
    • Observe settings via provider
    • Print settings
    • Log settings updates
    • Log errors
    • Combine sources
    • Scope sources
    • Make settings secret
    • Make settings required
  • Advanced scenarios
    • Use name aliases
    • Use dynamic interfaces
    • Use shared provider instance
    • Use value substitutions
    • Nest sources
    • Freeze sources
    • Transform sources
    • Create custom sources
    • Apply custom validators
    • Apply custom binders
    • Apply source data to existing object
    • Print contents of a source
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Concepts and basics

Error handling

PreviousCaching and performanceNextModules

Last updated 4 years ago

Was this helpful?

This page describes how deal with errors arising from and .

It can be summarized in two simple rules:

  • If an error occurs and no correct settings instance has been observed for the requested type thus far, the error is propagated to the calling code, resulting in exceptions from Get method. A subsequent settings update with correct data automatically "heals" future Get calls.

  • If an error occurs and a correct settings instance has already been observed for the requested type at least once, the error is and does not cause Get method to fail: last seen correct instance is returned from cache instead.

// the source contains incorrect data

provider.Get<MySettings>(); // throws an exception

// the source updates with correct data

provider.Get<MySettings>(); // returns settings

// the source updates with incorrect data once again

provider.Get<MySettings>(); // returns settings from cache

The second guarantee can be violated by cache overflow events. Read the to find out how to avoid them.

Observe method never produces OnError or OnCompleted notifications. It only reports successful settings updates. The errors are handled in background and .

Related pages

configuration providers
sources
binders
reported in background
caching section
can be logged
Configuration provider
Log errors
Obtain settings from provider
Obtain settings from provider