-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/options-refactor
- Loading branch information
Showing
3 changed files
with
195 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,42 @@ | ||
#![allow(clippy::module_inception)] | ||
mod airtable_fdw; | ||
mod result; | ||
|
||
use pgrx::pg_sys::panic::ErrorReport; | ||
use pgrx::prelude::PgSqlErrorCode; | ||
use thiserror::Error; | ||
|
||
use supabase_wrappers::prelude::{CreateRuntimeError, OptionsError}; | ||
|
||
#[derive(Error, Debug)] | ||
enum AirtableFdwError { | ||
#[error("column '{0}' data type is not supported")] | ||
UnsupportedColumnType(String), | ||
|
||
#[error("column '{0}' data type not match")] | ||
ColumnTypeNotMatch(String), | ||
|
||
#[error("{0}")] | ||
CreateRuntimeError(#[from] CreateRuntimeError), | ||
|
||
#[error("parse url failed: {0}")] | ||
UrlParseError(#[from] url::ParseError), | ||
|
||
#[error("request failed: {0}")] | ||
RequestError(#[from] reqwest_middleware::Error), | ||
|
||
#[error("{0}")] | ||
Options(#[from] OptionsError), | ||
} | ||
|
||
impl From<AirtableFdwError> for ErrorReport { | ||
fn from(value: AirtableFdwError) -> Self { | ||
match value { | ||
AirtableFdwError::CreateRuntimeError(e) => e.into(), | ||
AirtableFdwError::Options(e) => e.into(), | ||
_ => ErrorReport::new(PgSqlErrorCode::ERRCODE_FDW_ERROR, format!("{value}"), ""), | ||
} | ||
} | ||
} | ||
|
||
type AirtableFdwResult<T> = Result<T, AirtableFdwError>; |
Oops, something went wrong.