MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / forward_notices

Function forward_notices

src/environmentd/src/http/sql.rs:492–511  ·  view source on GitHub ↗

Forwards a collection of Notices to the provided [`WebSocket`].

(
    ws: &mut WebSocket,
    notices: impl IntoIterator<Item = AdapterNotice>,
)

Source from the content-addressed store, hash-verified

490
491/// Forwards a collection of Notices to the provided [`WebSocket`].
492async fn forward_notices(
493 ws: &mut WebSocket,
494 notices: impl IntoIterator<Item = AdapterNotice>,
495) -> Result<(), Error> {
496 let ws_notices = notices.into_iter().map(|notice| {
497 WebSocketResponse::Notice(Notice {
498 message: notice.to_string(),
499 code: notice.code().code().to_string(),
500 severity: notice.severity().as_str().to_lowercase(),
501 detail: notice.detail(),
502 hint: notice.hint(),
503 })
504 });
505
506 for notice in ws_notices {
507 send_ws_response(ws, notice).await?;
508 }
509
510 Ok(())
511}
512
513/// A request to execute SQL over HTTP.
514#[derive(Serialize, Deserialize, Debug)]

Callers 2

run_wsFunction · 0.85

Calls 10

send_ws_responseFunction · 0.85
severityMethod · 0.80
NoticeClass · 0.70
mapMethod · 0.45
into_iterMethod · 0.45
to_stringMethod · 0.45
codeMethod · 0.45
as_strMethod · 0.45
detailMethod · 0.45
hintMethod · 0.45

Tested by

no test coverage detected