例外¶
這裡介紹 PyPtt 的例外。
可以用 try...except... 來處理。
例外的種類
- exception PyPtt.exceptions.RequireLogin¶
需要登入。
- exception PyPtt.exceptions.NoPermission¶
沒有權限。
- exception PyPtt.exceptions.LoginError¶
登入失敗。
- exception PyPtt.exceptions.NoFastComment¶
無法快速推文。
- exception PyPtt.exceptions.NoSuchUser¶
查無此使用者。
- exception PyPtt.exceptions.NoSuchMail¶
查無此信件。
- exception PyPtt.exceptions.NoMoney¶
餘額不足。
- exception PyPtt.exceptions.NoSuchBoard¶
查無此看板。
- exception PyPtt.exceptions.ConnectionClosed¶
連線已關閉。
- exception PyPtt.exceptions.UnregisteredUser¶
未註冊使用者。
- exception PyPtt.exceptions.MultiThreadOperated¶
同時使用多個 thread 呼叫 PyPtt 。
- exception PyPtt.exceptions.WrongIDorPassword¶
帳號或密碼錯誤。
- exception PyPtt.exceptions.WrongPassword¶
密碼錯誤。
- exception PyPtt.exceptions.LoginTooOften¶
登入太頻繁。
- exception PyPtt.exceptions.UseTooManyResources¶
使用過多資源。
- exception PyPtt.exceptions.CantComment¶
禁止推文。
- exception PyPtt.exceptions.CantResponse¶
已結案並標記, 不得回應。
- exception PyPtt.exceptions.NeedModeratorPermission¶
需要版主權限。
- exception PyPtt.exceptions.ConnectError¶
連線失敗。
- exception PyPtt.exceptions.NoSuchPost¶
文章不存在。
- exception PyPtt.exceptions.CanNotUseSearchPostCode¶
無法使用搜尋文章代碼。
- exception PyPtt.exceptions.MailboxFull¶
信箱已滿。
- exception PyPtt.exceptions.NoSearchResult¶
搜尋結果為空。
- exception PyPtt.exceptions.OnlySecureConnection¶
只能使用安全連線。
- exception PyPtt.exceptions.SetContactMailFirst¶
請先設定聯絡信箱。
- exception PyPtt.exceptions.ResetYourContactEmail¶
請重新設定聯絡信箱。
- exception PyPtt.exceptions.ParameterError¶
參數錯誤,呼叫時傳入的參數值或組合不合法(例如 post 於
anonymous=False時仍傳入display_id)。
- exception PyPtt.exceptions.BadPostNotRecorded¶
板主刪除他人文章並指定 BadPostType 時,文章已成功刪除,但 PTT 端沒有完成惡退(劣文) 記錄流程(例如文章太舊而跳過惡退選單)。呼叫端應理解「刪除成功,但惡退未記錄」。
- exception PyPtt.exceptions.NoSuchLottery¶
查無樂透,該看板目前並沒有舉辦樂透,或樂透已封盤/開獎。