Skip to content

Commit 6c1ffdd

Browse files
feat(pyth-lazer-protocol): add pub error type (#2287)
1 parent 9e33560 commit 6c1ffdd

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

lazer/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lazer/sdk/rust/protocol/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyth-lazer-protocol"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
edition = "2021"
55
description = "Pyth Lazer SDK - protocol types."
66
license = "Apache-2.0"

lazer/sdk/rust/protocol/src/publisher.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
use {
66
super::router::{Price, PriceFeedId, TimestampUs},
7+
derive_more::derive::From,
78
serde::{Deserialize, Serialize},
89
};
910

@@ -32,6 +33,21 @@ pub struct PriceFeedData {
3233
pub best_ask_price: Option<Price>,
3334
}
3435

36+
/// A response sent from the server to the publisher client.
37+
/// Currently only serde errors are reported back to the client.
38+
#[derive(Debug, Clone, Serialize, Deserialize, From)]
39+
#[serde(tag = "type")]
40+
#[serde(rename_all = "camelCase")]
41+
pub enum PublisherResponse {
42+
UpdateDeserializationError(UpdateDeserializationErrorResponse),
43+
}
44+
/// Sent to the publisher if the binary data could not be parsed
45+
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
46+
#[serde(rename_all = "camelCase")]
47+
pub struct UpdateDeserializationErrorResponse {
48+
pub error: String,
49+
}
50+
3551
#[test]
3652
fn price_feed_data_serde() {
3753
let data = [

lazer/sdk/rust/protocol/src/subscription.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ pub struct SubscriptionErrorResponse {
6767
pub error: String,
6868
}
6969

70-
/// Sent from the server if an error occured while serving data for an existing subscription.
70+
/// Sent from the server if an internal error occured while serving data for an existing subscription,
71+
/// or a client request sent a bad request.
7172
#[derive(Debug, Clone, Serialize, Deserialize)]
7273
#[serde(rename_all = "camelCase")]
7374
pub struct ErrorResponse {

0 commit comments

Comments
 (0)