mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-11-26 12:36:14 -05:00
improve error messages on unparseable text protos
Takes advantage of stepancheg/rust-protobuf#428
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
|
||||
use base::clock::{self, Clocks};
|
||||
use db::auth::SessionFlags;
|
||||
use failure::{Error, bail, format_err};
|
||||
use failure::{Error, ResultExt, bail, format_err};
|
||||
use serde::Deserialize;
|
||||
use std::os::unix::fs::OpenOptionsExt as _;
|
||||
use std::io::Write as _;
|
||||
@@ -89,7 +89,7 @@ pub fn run() -> Result<(), Error> {
|
||||
let permissions = match args.flag_permissions {
|
||||
None => u.permissions.clone(),
|
||||
Some(s) => protobuf::text_format::parse_from_str(&s)
|
||||
.map_err(|_| format_err!("unable to parse --permissions"))?
|
||||
.context("unable to parse --permissions")?
|
||||
};
|
||||
let creation = db::auth::Request {
|
||||
when_sec: Some(db.clocks().realtime().sec),
|
||||
|
||||
@@ -33,7 +33,7 @@ use crate::stream;
|
||||
use crate::streamer;
|
||||
use crate::web;
|
||||
use db::{dir, writer};
|
||||
use failure::{Error, bail, format_err};
|
||||
use failure::{Error, ResultExt, bail};
|
||||
use fnv::FnvHashMap;
|
||||
use futures::{Future, Stream};
|
||||
use log::{error, info, warn};
|
||||
@@ -195,7 +195,7 @@ pub fn run() -> Result<(), Error> {
|
||||
let allow_unauthenticated_permissions = args.flag_allow_unauthenticated_permissions
|
||||
.map(|s| protobuf::text_format::parse_from_str(&s))
|
||||
.transpose()
|
||||
.map_err(|_| format_err!("Unable to parse --allow-unauthenticated-permissions"))?;
|
||||
.context("Unable to parse --allow-unauthenticated-permissions")?;
|
||||
let s = web::Service::new(web::Config {
|
||||
db: db.clone(),
|
||||
ui_dir: Some(&args.flag_ui_dir),
|
||||
|
||||
Reference in New Issue
Block a user