From 5bc1e3addb1025c384c19a7138fe3b8d2cf73847 Mon Sep 17 00:00:00 2001 From: Adam Hendel Date: Tue, 22 Aug 2023 14:06:58 -0500 Subject: [PATCH 1/2] Update image.yml --- .github/workflows/image.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml index 48961f46..065582ca 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/image.yml @@ -71,9 +71,8 @@ jobs: # if that file is present # and if the branch is 'main' or starts with 'release/' tag_cargo_version_if_present: ${{ steps.tags.outputs.tag_cargo }} - # Tag with 'latest' - # if the branch is 'main' - publish_latest: ${{ steps.tags.outputs.tag_latest }} + # never publish latest - that is handled in other workflow + publish_latest: false # If we are publishing latest, also tag it with calver publish_calver: ${{ steps.tags_outputs.tag_latest }} quay_user: ${{ secrets.QUAY_USER_TEMBO }} From 1532d1eefe2f0389f8e88e0c9b972e9dac00fc3a Mon Sep 17 00:00:00 2001 From: felipe stival <14948182+v0idpwn@users.noreply.github.com> Date: Tue, 22 Aug 2023 22:56:10 +0300 Subject: [PATCH 2/2] Improve error messages (#72) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Improve error messages * Update src/errors.rs * ext: wrap over PgmqError * format * Bump version --------- Co-authored-by: Vinícius R. Miguel Co-authored-by: Vinícius Miguel <36349314+vrmiguel@users.noreply.github.com> --- Cargo.lock | 2 +- Cargo.toml | 2 +- core/src/errors.rs | 2 +- src/api.rs | 2 +- src/errors.rs | 17 +++++++++++++++++ src/lib.rs | 19 +++---------------- 6 files changed, 24 insertions(+), 20 deletions(-) create mode 100644 src/errors.rs diff --git a/Cargo.lock b/Cargo.lock index 8618af15..43dce694 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1243,7 +1243,7 @@ dependencies = [ [[package]] name = "pgmq" -version = "0.14.2" +version = "0.14.3" dependencies = [ "chrono", "pgmq 0.16.1", diff --git a/Cargo.toml b/Cargo.toml index 91364f12..bf7baaf2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pgmq" -version = "0.14.2" +version = "0.14.3" edition = "2021" authors = ["Tembo.io"] description = "Postgres extension for PGMQ" diff --git a/core/src/errors.rs b/core/src/errors.rs index b5d41b12..6b8cad4f 100644 --- a/core/src/errors.rs +++ b/core/src/errors.rs @@ -18,6 +18,6 @@ pub enum PgmqError { /// a queue name error /// queue names must be alphanumeric and start with a letter - #[error("naming error: {name}")] + #[error("invalid queue name: '{name}'")] InvalidQueueName { name: String }, } diff --git a/src/api.rs b/src/api.rs index 7fa2a116..e34a284f 100644 --- a/src/api.rs +++ b/src/api.rs @@ -2,8 +2,8 @@ use pgrx::prelude::*; use pgrx::spi; use pgrx::spi::SpiTupleTable; +use crate::errors::PgmqExtError; use crate::partition::PARTMAN_SCHEMA; -use crate::PgmqExtError; use pgmq_crate::query::{destroy_queue, PGMQ_SCHEMA, TABLE_PREFIX}; #[pg_extern] diff --git a/src/errors.rs b/src/errors.rs new file mode 100644 index 00000000..caa04a83 --- /dev/null +++ b/src/errors.rs @@ -0,0 +1,17 @@ +use pgmq_crate::errors::PgmqError; +use thiserror::Error; + +#[derive(Error, Debug)] +pub enum PgmqExtError { + #[error("unexpected error")] + SqlError(#[from] pgrx::spi::Error), + + #[error("{0}")] + Core(#[from] PgmqError), + + #[error("{0} invalid types")] + TypeErrorError(String), + + #[error("missing dependency: {0}")] + MissingDependency(String), +} diff --git a/src/lib.rs b/src/lib.rs index ef805d3f..34bbd1b3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,6 +6,7 @@ use pgrx::warning; pgrx::pg_module_magic!(); pub mod api; +pub mod errors; pub mod metrics; pub mod partition; @@ -13,24 +14,10 @@ use pgmq_crate::errors::PgmqError; use pgmq_crate::query::{ archive, check_input, delete, init_queue, pop, read, PGMQ_SCHEMA, TABLE_PREFIX, }; -use thiserror::Error; -use std::time::Duration; - -#[derive(Error, Debug)] -pub enum PgmqExtError { - #[error("")] - SqlError(#[from] pgrx::spi::Error), - - #[error("")] - QueueError(#[from] PgmqError), +use errors::PgmqExtError; - #[error("{0} invalid types")] - TypeErrorError(String), - - #[error("missing dependency: {0}")] - MissingDependency(String), -} +use std::time::Duration; #[pg_extern] fn pgmq_create_non_partitioned(queue_name: &str) -> Result<(), PgmqExtError> {