/// <summary> /// Parses the returned server message to read properties. /// </summary> /// <param name="input">The deserializer holding the data form the server message.</param> internal void ParseHeader(Deserializer input) { try { // Skip the client executionId: the caller (background network thread) already verified a match and // we recorded it at the start. input.Skip(8); // Check field map for status header parsing. this._HasFields = (HasFields)input.ReadByte(); // Read the Status (and optional associated message). this.ServerStatus = (ResponseServerStatus)input.ReadSByte(); if ((this._HasFields & HasFields.Status) == HasFields.Status) this.ServerStatusString = input.ReadString(); // Read the Application Status (and optional associated message). this.ServerApplicationStatus = input.ReadSByte(); if ((this._HasFields & HasFields.ApplicationStatus) == HasFields.ApplicationStatus) this.ServerApplicationStatusString = input.ReadString(); // Track query duration (ms). this.ExecutionDuration = input.ReadInt32(); // Skip exception data (currently not used and initialized to the same value as the Status string!). if ((this._HasFields & HasFields.Exception) == HasFields.Exception) //this.ServerExceptionString = input.ReadString(); input.SkipString(); // Figure out whether to move forward or kill over - note that we don't *really* kill over, but simply // report the Exception in the response's Exception field - the caller should validate that the // response is in good status before proceeding to read the results. switch (this.ServerStatus) { case ResponseServerStatus.Success: break; case ResponseServerStatus.UserAbort: this.Exception = new VoltAbortException( Resources.RequestAborted , this.Status , this.ServerStatusString ); break; case ResponseServerStatus.GracefulFailure: this.Exception = new VoltRequestFailureException( Resources.RequestFailure , this.Status , this.ServerStatusString ); break; case ResponseServerStatus.UnexpectedFailure: this.Exception = new VoltCriticalRequestFailureException( Resources.RequestFailure , this.Status , this.ServerStatusString ); break; default: this.Exception = new VoltCriticalRequestFailureException( Resources.ServerFailure , this.Status , this.ServerStatusString ); break; } } catch (Exception x) { this.Exception = new VoltSerializationException(Resources.ResponseDeserializationFailure, x); } }
/// <summary> /// Parses the returned server message to read properties. /// </summary> /// <param name="input">The deserializer holding the data form the server message.</param> internal void ParseHeader(Deserializer input) { try { // Skip the client executionId: the caller (background network thread) already verified a match and // we recorded it at the start. input.Skip(8); // Check field map for status header parsing. this._HasFields = (HasFields)input.ReadByte(); // Read the Status (and optional associated message). this.ServerStatus = (ResponseServerStatus)input.ReadSByte(); if ((this._HasFields & HasFields.Status) == HasFields.Status) { this.ServerStatusString = input.ReadString(); } // Read the Application Status (and optional associated message). this.ServerApplicationStatus = input.ReadSByte(); if ((this._HasFields & HasFields.ApplicationStatus) == HasFields.ApplicationStatus) { this.ServerApplicationStatusString = input.ReadString(); } // Track query duration (ms). this.ExecutionDuration = input.ReadInt32(); // Skip exception data (currently not used and initialized to the same value as the Status string!). if ((this._HasFields & HasFields.Exception) == HasFields.Exception) { //this.ServerExceptionString = input.ReadString(); input.SkipString(); } // Figure out whether to move forward or kill over - note that we don't *really* kill over, but simply // report the Exception in the response's Exception field - the caller should validate that the // response is in good status before proceeding to read the results. switch (this.ServerStatus) { case ResponseServerStatus.Success: break; case ResponseServerStatus.UserAbort: this.Exception = new VoltAbortException( Resources.RequestAborted , this.Status , this.ServerStatusString ); break; case ResponseServerStatus.GracefulFailure: this.Exception = new VoltRequestFailureException( Resources.RequestFailure , this.Status , this.ServerStatusString ); break; case ResponseServerStatus.UnexpectedFailure: this.Exception = new VoltCriticalRequestFailureException( Resources.RequestFailure , this.Status , this.ServerStatusString ); break; default: this.Exception = new VoltCriticalRequestFailureException( Resources.ServerFailure , this.Status , this.ServerStatusString ); break; } } catch (Exception x) { this.Exception = new VoltSerializationException(Resources.ResponseDeserializationFailure, x); } }