You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off: thanks for your work implementing this package!
I'm getting started with web notifications, and trying some examples I discovered that a code example in the readme is incomplete / incorrect:
import WebPush
...do{tryawait manager.send(
json:["title":"Test Notification","body":"Hello, World!"
/// If sent from a request, pass the request's logger here to maintain its metadata.
// logger: request.logger
)}catchBadSubscriberError(){
/// The subscription is no longer valid and should be removed.
}catchMessageTooLargeError(){
/// The message was too long and should be shortened.
}catchlet error as HTTPError{
/// The push service ran into trouble. error.response may help here.
}catch{
/// An unknown error occurred.
}
The manager.send() function requires a to: parameter, and the HTTPError type doesn't seem to exist in this repository or any of the dependencies.
I'm also getting errors with the catch statements.
So the code sample could be rewritten to:
import WebPush
...do{tryawait manager.send(
json:["title":"Test Notification","body":"Hello, World!",
to: subscriber
/// If sent from a request, pass the request's logger here to maintain its metadata.
// logger: request.logger
)}catch is BadSubscriberError{
/// The subscription is no longer valid and should be removed.
}catch is MessageTooLargeError{
/// The message was too long and should be shortened.
}catch{
/// An unknown error occurred.
}
The text was updated successfully, but these errors were encountered:
First off: thanks for your work implementing this package!
I'm getting started with web notifications, and trying some examples I discovered that a code example in the readme is incomplete / incorrect:
The
manager.send()
function requires ato:
parameter, and theHTTPError
type doesn't seem to exist in this repository or any of the dependencies.I'm also getting errors with the catch statements.
So the code sample could be rewritten to:
The text was updated successfully, but these errors were encountered: