mononoke: add context to blobstore_sync_queue get error handling

Summary: Add context to show the affected key if there are problems peeking a key.

Reviewed By: farnz

Differential Revision: D23003001

fbshipit-source-id: b46b7626257f49d6f11e80a561820e4b37a5d3b0
This commit is contained in:
Alex Hornby 2020-08-11 02:51:06 -07:00 committed by Facebook GitHub Bot
parent 0a8c81c668
commit 74f2e7affc

View File

@ -7,7 +7,7 @@
#![deny(warnings)]
use anyhow::{format_err, Error};
use anyhow::{format_err, Context, Error};
use async_trait::async_trait;
use auto_impl::auto_impl;
use cloned::cloned;
@ -19,7 +19,7 @@ use futures::{
stream::StreamExt,
};
use metaconfig_types::{BlobstoreId, MultiplexId};
use mononoke_types::{DateTime, Timestamp};
use mononoke_types::{errors::ErrorKind, DateTime, Timestamp};
use sql::mysql_async::{
prelude::{ConvIr, FromValue},
FromValueError, Value,
@ -441,7 +441,8 @@ impl BlobstoreSyncQueue for SqlBlobstoreSyncQueue {
) -> Result<Vec<BlobstoreSyncQueueEntry>, Error> {
let rows = GetByKey::query(&self.read_master_connection, key)
.compat()
.await?;
.await
.with_context(|| ErrorKind::BlobKeyError(key.clone()))?;
Ok(rows
.into_iter()
.map(