feat(gitea): Improve error message on invalid config
This commit is contained in:
parent
48dea1b884
commit
0da913ec7c
3 changed files with 14 additions and 5 deletions
|
@ -5,7 +5,7 @@ use std::path::Path;
|
||||||
use cli_table::format::Justify;
|
use cli_table::format::Justify;
|
||||||
use cli_table::{Cell, Style, Table};
|
use cli_table::{Cell, Style, Table};
|
||||||
use color_eyre::eyre::{self, Context};
|
use color_eyre::eyre::{self, Context};
|
||||||
use color_eyre::{Help, Report, Result};
|
use color_eyre::{Help, Report, Result, SectionExt as _};
|
||||||
use globwalk::{DirEntry, GlobWalkerBuilder};
|
use globwalk::{DirEntry, GlobWalkerBuilder};
|
||||||
use reqwest::StatusCode;
|
use reqwest::StatusCode;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -275,7 +275,10 @@ pub(crate) fn run(action: &Action) -> Result<()> {
|
||||||
eyre::bail!("No data received on stdin");
|
eyre::bail!("No data received on stdin");
|
||||||
}
|
}
|
||||||
|
|
||||||
serde_json::from_str(&buf).wrap_err("Failed to parse stdin")?
|
serde_json::from_str(&buf)
|
||||||
|
.wrap_err("Failed to parse config")
|
||||||
|
.with_suggestion(|| "Double-check the `source` and `params` sections in your pipeline")
|
||||||
|
.with_section(|| buf.header("JSON"))?
|
||||||
};
|
};
|
||||||
|
|
||||||
match action {
|
match action {
|
||||||
|
|
|
@ -5,7 +5,7 @@ use std::path::Path;
|
||||||
use cli_table::format::Justify;
|
use cli_table::format::Justify;
|
||||||
use cli_table::{print_stderr, Cell, Style, Table};
|
use cli_table::{print_stderr, Cell, Style, Table};
|
||||||
use color_eyre::eyre::{self, Context};
|
use color_eyre::eyre::{self, Context};
|
||||||
use color_eyre::Result;
|
use color_eyre::{Result, Section as _, SectionExt as _};
|
||||||
use reqwest::blocking::Response;
|
use reqwest::blocking::Response;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
@ -160,7 +160,10 @@ pub(crate) fn run(action: &Action) -> Result<()> {
|
||||||
eyre::bail!("No data received on stdin");
|
eyre::bail!("No data received on stdin");
|
||||||
}
|
}
|
||||||
|
|
||||||
serde_json::from_str(&buf).wrap_err("Failed to parse stdin")?
|
serde_json::from_str(&buf)
|
||||||
|
.wrap_err("Failed to parse config")
|
||||||
|
.with_suggestion(|| "Double-check the `source` and `params` sections in your pipeline")
|
||||||
|
.with_section(|| buf.header("JSON"))?
|
||||||
};
|
};
|
||||||
|
|
||||||
match action {
|
match action {
|
||||||
|
|
|
@ -144,7 +144,10 @@ pub(crate) fn run(action: &Action) -> Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
serde_json::from_str(&buf)
|
serde_json::from_str(&buf)
|
||||||
.wrap_err("Failed to parse stdin")
|
.wrap_err("Failed to parse config")
|
||||||
|
.with_suggestion(|| {
|
||||||
|
"Double-check the `source` and `params` sections in your pipeline"
|
||||||
|
})
|
||||||
.with_section(|| buf.header("JSON"))?
|
.with_section(|| buf.header("JSON"))?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue