import { MappingError , createErrorMessage } from "./mappingError" ; import { InternalSession } from "../session" ; import { Observer } from "../observer" ; hidden export class ReadContext { /**
     * The current path.
     */ path : string = "" ; /**
     * A list of errors that occurred during deserialization.
     */ errors : MappingError [ ] ; /**
     * True if there are errors in the context; otherwise, false.
     */ hasErrors : boolean ; /**
     * Observer used to watch deserialized objects, if specified.
     */ observer : Observer ; /**
     * Fetches found while walking the object.
     */ fetches : string [ ] ; /**
     * The parent object.
     */ parent : Object ; constructor ( public session ) { } param message param path addError ( message , path ? ) { if ( ! this . errors ) { this . errors = [ ] ; this . hasErrors = true ; } this . errors . push ( { message : message , path : path || this . path } ) ; } addFetch ( path ) { if ( ! this . fetches ) { this . fetches = [ ] ; } this . fetches . push ( path ) ; } /**
     * Gets a string summarizing all errors in the context.
     */ getErrorMessage ( ) { return createErrorMessage ( this . errors ) ; } }