Skip to content

Commit

Permalink
fix: error exporting for remote cli commands
Browse files Browse the repository at this point in the history
  • Loading branch information
mvayngrib committed Apr 21, 2018
1 parent 1aa8a0d commit 626adae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/friends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default class Friends {

public load = async (opts: ILoadFriendOpts): Promise<any> => {
let { url } = opts
if (!url) throw new Error(`expected "url" of friend's MyCloud`)
if (!url) throw new Errors.InvalidInput(`expected "url" of friend's MyCloud`)

url = url.replace(/[/]+$/, "")

Expand Down
6 changes: 5 additions & 1 deletion src/in-house-bot/lambda/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// })
// })

import pick from 'lodash/pick'
import { fromCli, fromHTTP } from '../lambda'
import { createBot } from '../../bot'
import { IPBMiddlewareContext } from '../types'
Expand All @@ -23,7 +24,10 @@ lambda.use(async (ctx:IPBMiddlewareContext, next) => {
sudo: true
})

ctx.body = { result, error }
ctx.body = {
result,
error: error && pick(error, ['name', 'type', 'message'])
}
})

export const handler = lambda.handler

0 comments on commit 626adae

Please sign in to comment.