Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
c13e2f5b
Commit
c13e2f5b
authored
8 years ago
by
murgatroid99
Browse files
Options
Downloads
Patches
Plain Diff
Node: correctly bubble up errors caused by non-serializable writes
parent
82870cad
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/node/src/client.js
+12
-1
12 additions, 1 deletion
src/node/src/client.js
src/node/src/server.js
+6
-1
6 additions, 1 deletion
src/node/src/server.js
with
18 additions
and
2 deletions
src/node/src/client.js
+
12
−
1
View file @
c13e2f5b
...
@@ -99,7 +99,18 @@ function ClientWritableStream(call, serialize) {
...
@@ -99,7 +99,18 @@ function ClientWritableStream(call, serialize) {
function
_write
(
chunk
,
encoding
,
callback
)
{
function
_write
(
chunk
,
encoding
,
callback
)
{
/* jshint validthis: true */
/* jshint validthis: true */
var
batch
=
{};
var
batch
=
{};
var
message
=
this
.
serialize
(
chunk
);
var
message
;
try
{
message
=
this
.
serialize
(
chunk
);
}
catch
(
e
)
{
/* Sending this error to the server and emitting it immediately on the
client may put the call in a slightly weird state on the client side,
but passing an object that causes a serialization failure is a misuse
of the API anyway, so that's OK. The primary purpose here is to give the
programmer a useful error and to stop the stream properly */
this
.
call
.
cancelWithStatus
(
grpc
.
status
.
INTERNAL
,
"
Serialization failure
"
);
callback
(
e
);
}
if
(
_
.
isFinite
(
encoding
))
{
if
(
_
.
isFinite
(
encoding
))
{
/* Attach the encoding if it is a finite number. This is the closest we
/* Attach the encoding if it is a finite number. This is the closest we
* can get to checking that it is valid flags */
* can get to checking that it is valid flags */
...
...
This diff is collapsed.
Click to expand it.
src/node/src/server.js
+
6
−
1
View file @
c13e2f5b
...
@@ -278,7 +278,12 @@ function _write(chunk, encoding, callback) {
...
@@ -278,7 +278,12 @@ function _write(chunk, encoding, callback) {
(
new
Metadata
()).
_getCoreRepresentation
();
(
new
Metadata
()).
_getCoreRepresentation
();
this
.
call
.
metadataSent
=
true
;
this
.
call
.
metadataSent
=
true
;
}
}
var
message
=
this
.
serialize
(
chunk
);
var
message
;
try
{
message
=
this
.
serialize
(
chunk
);
}
catch
(
e
)
{
callback
(
e
);
}
if
(
_
.
isFinite
(
encoding
))
{
if
(
_
.
isFinite
(
encoding
))
{
/* Attach the encoding if it is a finite number. This is the closest we
/* Attach the encoding if it is a finite number. This is the closest we
* can get to checking that it is valid flags */
* can get to checking that it is valid flags */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment