zoukankan      html  css  js  c++  java
  • error.go源码笔记

    package pingo

    import (
        "errors"
        "strings"
    )

    const (
        errorCodeConnFailed = "err-connection-failed"
        errorCodeHttpServe  = "err-http-serve"
    )

    // Error reported when connection to the external plugin has failed.
    type ErrConnectionFailed error

    // Error reported when the external plugin cannot start listening for calls.
    type ErrHttpServe error

    // Error reported when an invalid message is printed by the external plugin.
    type ErrInvalidMessage error

    // Error reported when the plugin fails to register before the registration
    // timeout expires.
    type ErrRegistrationTimeout error

    func parseError(line string) error {
        parts := strings.SplitN(line, ": ", 2)
        if parts[0] == "" {
            return nil
        }

        err := errors.New(parts[1])

        switch parts[0] {
        case errorCodeConnFailed:
            return ErrConnectionFailed(err)
        case errorCodeHttpServe:
            return ErrHttpServe(err)
        }

        return err
    }
  • 相关阅读:
    Loj #6560 小奇取石子
    某谷 P5153 简单的函数
    某谷 P5159 WD与矩阵
    前端ajax访问 django 报错 POST http://127.0.0.1:8001/xxx 403 (Forbidden)
    python
    Java
    Java
    Java
    Java
    java web 向数据库插入中文数据乱码问题
  • 原文地址:https://www.cnblogs.com/zhangboyu/p/7457530.html
Copyright © 2011-2022 走看看