@@ -27,6 +27,7 @@ import * as RoomCreation from "./RoomCreation";
2727import { getBridgeVersion } from "matrix-appservice-bridge" ;
2828import { IdentGenerator } from "../irc/IdentGenerator" ;
2929import { Provisioner } from "../provisioning/Provisioner" ;
30+ import { IrcProvisioningError } from "../provisioning/Schema" ;
3031
3132const log = logging ( "AdminRoomHandler" ) ;
3233
@@ -239,6 +240,9 @@ export class AdminRoomHandler {
239240 }
240241 catch ( ex ) {
241242 log . error ( `Failed to handle !plumb command:` , ex ) ;
243+ if ( ex instanceof IrcProvisioningError ) {
244+ return new MatrixAction ( ActionType . Notice , `Failed to plumb room. ${ ex . message } ` ) ;
245+ }
242246 return new MatrixAction ( ActionType . Notice , "Failed to plumb room. Check the logs for details." ) ;
243247 }
244248 return new MatrixAction ( ActionType . Notice , "Room plumbed." ) ;
@@ -272,6 +276,9 @@ export class AdminRoomHandler {
272276 }
273277 catch ( ex ) {
274278 log . error ( `Failed to handle !unlink command:` , ex ) ;
279+ if ( ex instanceof IrcProvisioningError ) {
280+ return new MatrixAction ( ActionType . Notice , `Failed to plumb room. ${ ex . message } ` ) ;
281+ }
275282 return new MatrixAction ( ActionType . Notice , "Failed to unlink room. Check the logs for details." ) ;
276283 }
277284 return new MatrixAction ( ActionType . Notice , "Room unlinked." ) ;
@@ -282,7 +289,7 @@ export class AdminRoomHandler {
282289 // check that the server exists and that the user_id is on the whitelist
283290 const ircChannel = args [ 0 ] ;
284291 const key = args [ 1 ] ; // keys can't have spaces in them, so we can just do this.
285- let errText = null ;
292+ let errText : string | null = null ;
286293 if ( ! ircChannel || ! ircChannel . startsWith ( "#" ) ) {
287294 errText = "Format: '!join irc.example.com #channel [key]'" ;
288295 }
0 commit comments