Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 699x 699x 699x 699x 699x 699x 699x 699x 699x 41x 41x 41x 141x 141x 70x 70x 70x 70x 141x 41x 41x 41x 117x 117x 117x 41x 41x 840x 840x 71x 840x 769x 769x 769x 769x 769x 769x 769x 769x 769x 840x 41x 117x 117x 117x 117x 115x 115x 115x 115x 117x 2x 2x 117x 117x 117x 117x 117x 117x 56x 56x 56x 56x 56x 56x 56x 56x 56x 117x 47x 47x 47x 61x 10x 10x 12x 4x 4x 4x 117x 117x 59x 59x 59x 59x 59x 59x 30x 59x 33x 33x 33x 33x 31x 31x 31x 31x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 31x 33x 2x 2x 33x 59x 26x 26x 26x 26x 26x 59x 117x 117x 117x 117x | // Copyright (c) ZeroC, Inc. import { Current } from "./Current.js"; import { FormatType } from "./FormatType.js"; import { OutgoingResponse } from "./OutgoingResponse.js"; import { LocalException } from "./LocalException.js"; import { UserException } from "./UserException.js"; import { DispatchException, RequestFailedException } from "./LocalExceptions.js"; import { OutputStream } from "./OutputStream.js"; import { Protocol } from "./Protocol.js"; import { Ice as Ice_BuiltinSequences } from "./BuiltinSequences.js"; const { StringSeqHelper } = Ice_BuiltinSequences; import { Ice as Ice_ReplyStatus } from "./ReplyStatus.js"; const { ReplyStatus } = Ice_ReplyStatus; import { Ice as Ice_Identity } from "./Identity.js"; const { Identity } = Ice_Identity; Current.prototype.createOutgoingResponseWithResult = function (marshal, formatType = null) { const ostr = startReplyStream(this); if (this.requestId != 0) { try { ostr.startEncapsulation(this.encoding, formatType); marshal(ostr); ostr.endEncapsulation(); return new OutgoingResponse(ostr); } catch (ex) { return this.createOutgoingResponseWithException(ex); } } else { console.assert(false, "A one-way request cannot return a response"); return new OutgoingResponse(ostr); } }; Current.prototype.createEmptyOutgoingResponse = function () { const ostr = startReplyStream(this); if (this.requestId != 0) { try { ostr.writeEmptyEncapsulation(this.encoding); } catch (ex) { return this.createOutgoingResponse(ex); } } return new OutgoingResponse(ostr); }; Current.prototype.createOutgoingResponseWithException = function (exception) { try { return createOutgoingResponseCore(this, exception); } catch { // Try a second time with the marshal exception. This should not fail. return createOutgoingResponseCore(this, exception); } }; function startReplyStream(current, replyStatus = ReplyStatus.Ok) { if (current.requestId == 0) { return new OutputStream(); } else { let ostr = new OutputStream( Protocol.currentProtocolEncoding, current.adapter.getCommunicator().instance.defaultsAndOverrides().defaultFormat, ); ostr.writeBlob(Protocol.replyHdr); ostr.writeInt(current.requestId); ostr.writeByte(replyStatus.value); return ostr; } } function createOutgoingResponseCore(current, exception) { let ostr; if (current.requestId != 0) { // The default class format doesn't matter since we always encode user exceptions in Sliced format. ostr = new OutputStream(Protocol.currentProtocolEncoding); ostr.writeBlob(Protocol.replyHdr); ostr.writeInt(current.requestId); } else { ostr = new OutputStream(); } let replyStatus; let exceptionId; let dispatchExceptionMessage = null; if (exception instanceof UserException) { exceptionId = null; replyStatus = ReplyStatus.UserException; if (current.requestId != 0) { ostr.writeByte(replyStatus.value); ostr.startEncapsulation(current.encoding, FormatType.SlicedFormat); ostr.writeException(exception); ostr.endEncapsulation(); } } else if (exception instanceof DispatchException) { exceptionId = exception.ice_id(); replyStatus = exception.replyStatus; dispatchExceptionMessage = exception.message; } else if (exception instanceof LocalException) { exceptionId = exception.ice_id(); replyStatus = ReplyStatus.UnknownLocalException; } else { exceptionId = exception.name; replyStatus = ReplyStatus.UnknownException; } if (replyStatus.value > ReplyStatus.UserException.value && current.requestId != 0) { // Marshal a possibly unknown reply status value. ostr.writeByte(replyStatus.value); if ( replyStatus === ReplyStatus.ObjectNotExist || replyStatus === ReplyStatus.FacetNotExist || replyStatus === ReplyStatus.OperationNotExist ) { let id = new Identity(); let facet = ""; let operation = ""; if (exception instanceof RequestFailedException) { id = exception.id; facet = exception.facet; operation = exception.operation; } if (id.name.length == 0) { id = current.id; facet = current.facet; } if (operation.length == 0) { operation = current.operation; } id._write(ostr); if (facet.length == 0) { StringSeqHelper.write(ostr, []); } else { StringSeqHelper.write(ostr, [facet]); } ostr.writeString(operation); } else { // If the exception is a DispatchException, we keep its message as-is; otherwise, we create a custom // message. This message doesn't include the stack trace. dispatchExceptionMessage ??= `Dispatch failed with ${exceptionId}: ${exception.message}`; ostr.writeString(dispatchExceptionMessage); } } // The stack includes the class name and error message. return new OutgoingResponse(ostr, replyStatus, exceptionId, exceptionId != null ? exception.stack : null); } |