Standard library / net/url

url.Error.Error()

Format the wrapped operation, URL and underlying error. URL text can include sensitive data. Expected stdout: 'Get "https://example.invalid": demo\n'.

Formal Syntax & Structure

go syntaxgo
func (e *Error) Error() string

Return Value

string

Operation result; check errors and validity indicators when returned.

Working Example

Example Snippetgo
package main
import (  "errors"  "fmt"  "net/url")
func main() {  fmt.Println((&url.Error{Op: "Get", URL: "https://example.invalid", Err: errors.New("demo")}).Error())}
func must[T any](v T, e error) T {  if e != nil {    panic(e)  }  return v}func check(e error) {  if e != nil {    panic(e)  }}
Go Reference