`getInvoice` never detects "not found": unknown invoice ids show a raw host error

Đang mở Phù hợp với người mới
#58 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
86/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
nextjs, typescript
Lĩnh vực
frontend, web-dev

Hướng nghiên cứu

Bắt đầu từ web/lib/contract.ts, nơi getInvoice kiểm tra message.includes("InvoiceNotFound"), và thêm cách nhận diện Error(Contract, #3) trong khi giữ việc so khớp theo tên, trả về null trong cả hai trường hợp. Kiểm tra web/app/pay/[id]/page.tsx để xác nhận kết quả null hiển thị thông báo "không tồn tại". Hoàn thành khi /pay/999999 hiển thị thông báo đó, getAllInvoices không thay đổi và các id hợp lệ vẫn tải được.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug difficulty: beginner good first issue help wanted web

Difficulty: Beginner

Problem

getInvoice checks message.includes("InvoiceNotFound"). Verified against the live testnet contract, the simulation error for an unknown id is HostError: Error(Contract, #3), so the check never matches. /pay/<unknown id> therefore shows the raw host error instead of "Invoice doesn't exist".

Why it matters

Opening a wrong or mistyped payment link is the most common client mistake, and it currently gets the worst message.

Scope of work

Detect Error(Contract, #3) (keep the name match too) and return null; add a unit test if a test runner is available (see #13).

Acceptance criteria

  • /pay/999999 shows the "doesn't exist" message.
  • getAllInvoices behaves as before.
  • Valid ids are unaffected.

Relevant files

  • web/lib/contract.ts, web/app/pay/[id]/page.tsx

Dependencies

Overlaps in spirit with #12 (error mapping), but this fix stands alone.

Maintainer discussion needed?

No.

Ngôn ngữ chính
TypeScript
Star
0
Fork
4
Merge trung bình
54 phút
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Yormee-103/PayLoop

Tất cả issue của Yormee-103/PayLoop

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.