import { MappingError , createErrorMessage } from "./mappingError" ; import { InternalSession } from "../session" ; hidden export class WriteContext { /**
     * A list of errors that occurred during serialization.
     */ errors : MappingError [ ] = [ ] ; /**
     * Listed of objects that have been visited to prevent infinite loops.
     */ visited : any [ ] = [ ] ; /**
     * True if there are errors in the context; otherwise, false.
     */ hasErrors : boolean ; param path constructor ( public path = "" ) { } param message param path addError ( message , path ? ) { this . errors . push ( { message : message , path : path || this . path } ) ; this . hasErrors = true ; } /**
     * Gets a string summarizing all errors in the context.
     */ getErrorMessage ( ) { return createErrorMessage ( this . errors ) ; } }