本文整理匯總了TypeScript中@jonggrang/task.raise函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript raise函數的具體用法?TypeScript raise怎麽用?TypeScript raise使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了raise函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Error
export function eachObjLim<A, B>(
n: number,
ms: Record<string, A>,
fn: (a: A, i: string) => T.Task<B>
): T.Task<Record<string, B>> {
return n <= 0 ? T.raise(new Error('1 arguments to eachObjLim must be greater than zero'))
: newQSem(n).chain(qsem => eachObjPar(ms, (v, i) => withQSem(qsem, fn(v, i))));
}
示例2: FileInfo
.chain(stat => {
if (stat.isFile()) {
let time = H.fromDate(stat.mtime);
let date = H.formatHttpDate(time);
return T.pure(new FileInfo(path, stat.size, time, date));
}
return T.raise(new Error(`getInfo: ${path} isn't a file`));
});
示例3: Error
return fcache.read.chain(cache => {
const there = HM.lookup(hash, path, cache);
if (isJust(there)) {
const entry = there.value;
return entry.tag === EntryType.NEGATIVE ? T.raise(new Error('FileInfoCache:getAndRegisterInfo'))
: T.pure(entry.finfo);
}
return T.rescue(positive(fcache, hash, path), () => negative(fcache, hash, path));
});
示例4: getSessionImpl
return getSessionImpl(storage, sess.id).chain(oldSess => {
if (oldSess) return T.raise(new SessionAlreadyExists(oldSess, sess));
const sk = storage.sessionKey(sess.id);
let commands: string[][] = [['hmset', sk].concat(printSession(sess))];
// ttl
let ttl = expireSession(sess, storage);
if (ttl !== null) commands.push(ttl);
// auth
if (sess.authId)
commands.push(['sadd', storage.authKey(sess.authId), sk]);
return transaction(commands, storage.redis).map(absurd);
});
示例5: destroy
destroy(sessId: string) {
return T.raise(new TNTExplosion('destroy', { sessId }));
}
示例6: get
get(sessId: string) {
return T.raise(new TNTExplosion('get', { sessId }));
}
示例7: onlyTiny0
function onlyTiny0(ctx: any, file: FileUpload): T.Task<boolean> {
return file.fieldname === 'tiny0' ? T.pure(true) : T.raise(new Error('only tiny0 allowed'));
}
示例8: send
return send(W.responseStream(200, headers, () => T.raise(new Error('should not evaluated'))));
示例9: replace
replace(session: SS.Session) {
return T.raise(new TNTExplosion('replace', session));
}