JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • error as an interface — nil / non-nil

    Go SELF
    16 level,0 lecture
    We break down why error in Go is an interface, how the contract err == nil (success) and err != nil (error) works, how fmt prints errors via the Error() method, why you must not build logic based on the text of err. Error(), and what this looks like in practice with strconv. Atoi. At the end — a mini app “Expense tracking”, a mermaid flow diagram, and typical beginner mistakes.
    Open
  • Creating errors: errors.New and fmt.Errorf

    Go SELF
    16 level,1 lecture
    We break down why in Go it’s customary to return errors rather than print them inside functions, and how to create errors using errors . New ( "..." ) and fmt . Errorf ( "..." , x ). We’ll talk about returning zero value in the signature ( T , error ), adding context to someone else’s errors via fmt . Errorf (without %w), and we’ll build a mini calculator with validation. At the end — common mistakes and how to avoid them.
    Open
  • The Essence of Error Handling

    Go SELF
    16 level,2 lecture
    We break down the philosophy and practice of error handling in Go: why the idiom if err != nil shows up everywhere, how an early return makes code linear and readable (a happy path without nesting), what to return from functions with the contract ( T , error ) and why you need a zero value. We will also show adding context via fmt. Errorf without %w, the run () error pattern for a “thin” main (), an example mini-app TaskBox, and a set of micro-patterns/anti-patterns.
    Open
  • Go-style error text

    Go SELF
    16 level,3 lecture
    We break down the “Go-ish” style of error messages: why the error text is a public interface of the error type, how to write messages in lowercase and without a period, why you don’t need the "Error:" prefix, how to build chains in the "operation: reason" format, how to add context via fmt. Errorf (), and which details (for example, %q, %d) help make errors useful in logs and tests.
    Open
  • How to Choose an API Contract: error, bool, or (T, bool)

    Go SELF
    16 level,4 lecture
    We break down how to design function contracts in Go: when it makes sense to return bool (predicates), when (T, bool) is better (lookup/get without “magic values”), and when you need error or (T, error) (the reason for failure matters). Using TodoLite examples, we compare the semantics of “not found” vs “error”, collect selection criteria into a table, and lock the decision in with a flowchart (mermaid). Finally, we cover typical mistakes when choosing a contract and how to avoid them.
    Open
Learn
  • Registration
  • Java course
  • Help with tasks
  • Pricing
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Activities
Company
  • About us
  • Contacts
  • Reviews
  • FAQ
  • Support
JavaRushJavaRush — is an interactive online course for learning Java programming from scratch. It contains 1200 practical tasks with one-click solution checking, the necessary minimum of theory on Java basics, and motivating features that help you complete the course: games, quizzes, interesting projects and articles on effective learning and the career of a Java developer.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush
MastercardVisa
"Programmers are not born" © 2026 JavaRush