-
-
Notifications
You must be signed in to change notification settings - Fork 6
Status Codes
Richard Fu edited this page Jan 3, 2026
·
2 revisions
Complete reference of all RGS status codes returned by the Stake Engine Client functions.
All Stake Engine Client functions return a consistent status structure:
interface Status {
statusCode: StatusCode;
statusMessage?: string;
}| Code | Description | Functions | Meaning |
|---|---|---|---|
SUCCESS |
Operation completed successfully | All functions | Continue normal flow |
| Code | Description | Common Causes | Recommended Action |
|---|---|---|---|
ERR_IS |
Invalid session or session timeout | • Session expired • Invalid sessionID • Server restart |
• Re-authenticate user • Redirect to login • Refresh session token |
ERR_ATE |
Authentication failed/expired | • Invalid credentials • Account disabled • Token corruption |
• Check credentials • Re-authenticate • Contact support if persistent |
| Code | Description | Common Causes | Recommended Action |
|---|---|---|---|
ERR_IPB |
Insufficient player balance | • Balance lower than bet • Concurrent transactions • Balance sync issues |
• Show current balance • Suggest smaller bet • Offer deposit option |
ERR_GLE |
Gambling limits exceeded | • Daily limit reached • Session limit exceeded • Regulatory limits |
• Show limit details • Suggest lower bet • Display time until reset |
| Code | Description | Common Causes | Recommended Action |
|---|---|---|---|
ERR_BNF |
Bet not found / No active round | • No round active • Round already ended • Invalid round state |
• Check game state • Start new round • Often normal for end operations |
| Code | Description | Common Causes | Recommended Action |
|---|---|---|---|
ERR_UE |
Unknown server error | • Internal server error • Database issues • Service unavailable |
• Retry operation • Show generic error • Contact support if persistent |
| Status Code | Probability | Meaning |
|---|---|---|
SUCCESS |
95%+ | Authentication successful |
ERR_IS |
3% | Invalid/expired session |
ERR_ATE |
1% | Authentication failed |
ERR_UE |
<1% | Server error |
| Status Code | Probability | Meaning |
|---|---|---|
SUCCESS |
85%+ | Bet placed successfully |
ERR_IPB |
10% | Insufficient balance |
ERR_IS |
3% | Session expired |
ERR_GLE |
1% | Gambling limits exceeded |
ERR_UE |
<1% | Server error |
| Status Code | Probability | Meaning |
|---|---|---|
SUCCESS |
90%+ | Round ended successfully |
ERR_BNF |
8% | No active round (often normal) |
ERR_IS |
1% | Session expired |
ERR_UE |
<1% | Server error |
| Status Code | Probability | Meaning |
|---|---|---|
SUCCESS |
95%+ | Balance retrieved successfully |
ERR_IS |
4% | Session expired |
ERR_UE |
<1% | Server error |
| Status Code | Probability | Meaning |
|---|---|---|
SUCCESS |
90%+ | Event tracked successfully |
ERR_BNF |
7% | No active round |
ERR_IS |
2% | Session expired |
ERR_UE |
<1% | Server error |
| Status Code | Probability | Meaning |
|---|---|---|
SUCCESS |
95%+ | Search completed |
ERR_UE |
5% | Search failed or no results |
const highPriorityErrors = [
'ERR_IS', // Session expired - redirect to login
'ERR_ATE', // Authentication failed - re-authenticate
'ERR_IPB' // Insufficient balance - show balance error
];const mediumPriorityErrors = [
'ERR_GLE', // Gambling limits - show limits message
'ERR_UE' // Server error - show retry option
];const lowPriorityErrors = [
'ERR_BNF' // No active round - may be expected
];if (response.status?.statusCode === 'SUCCESS') {
console.log('✅ Operation successful');
// Process response data
processSuccess(response);
}switch (response.status?.statusCode) {
case 'ERR_IS':
console.log('🔐 Session expired');
redirectToLogin();
break;
case 'ERR_ATE':
console.log('🚫 Authentication failed');
showAuthenticationError();
break;
}switch (response.status?.statusCode) {
case 'ERR_IPB':
console.log('💰 Insufficient balance');
showBalanceError(currentBalance);
break;
case 'ERR_GLE':
console.log('🚫 Gambling limits exceeded');
showLimitsError(dailyLimit, sessionLimit);
break;
}switch (response.status?.statusCode) {
case 'ERR_UE':
console.log('🔧 Server error');
showRetryDialog();
break;
case 'ERR_BNF':
console.log('⚠️ No active round');
// This might be normal - check context
if (expectingActiveRound) {
showRoundStateError();
}
break;
}class ErrorAnalytics {
private static errorCounts: Map<string, number> = new Map();
private static totalRequests: number = 0;
static trackError(statusCode: string): void {
this.errorCounts.set(
statusCode,
(this.errorCounts.get(statusCode) || 0) + 1
);
this.totalRequests++;
}
static getErrorRate(statusCode: string): number {
const count = this.errorCounts.get(statusCode) || 0;
return this.totalRequests > 0 ? (count / this.totalRequests) * 100 : 0;
}
static getTopErrors(): Array<{code: string, rate: number}> {
return Array.from(this.errorCounts.entries())
.map(([code, count]) => ({
code,
rate: (count / this.totalRequests) * 100
}))
.sort((a, b) => b.rate - a.rate)
.slice(0, 5);
}
}
// Usage
ErrorAnalytics.trackError('ERR_IPB');
console.log('Error rates:', ErrorAnalytics.getTopErrors());class StatusLogger {
static log(
functionName: string,
statusCode: string,
statusMessage?: string,
context?: any
): void {
const timestamp = new Date().toISOString();
const level = this.getLogLevel(statusCode);
console[level](`[${timestamp}] ${functionName}: ${statusCode}`, {
message: statusMessage,
context: context
});
}
private static getLogLevel(statusCode: string): 'log' | 'warn' | 'error' {
if (statusCode === 'SUCCESS') return 'log';
if (statusCode === 'ERR_BNF') return 'warn';
return 'error';
}
}
// Usage in functions
const bet = await play({ currency: 'USD', amount: 1.00, mode: 'base' });
StatusLogger.log('play', bet.status?.statusCode || 'NO_STATUS', bet.status?.statusMessage, { amount: 1.00 });// ✅ Good
if (response.status?.statusCode === 'SUCCESS') {
// Handle success
} else {
// Handle specific error
}
// ❌ Bad
if (response.data) {
// Assuming success based on data
}// ✅ Good - Handle expected errors specifically
switch (response.status?.statusCode) {
case 'SUCCESS':
handleSuccess();
break;
case 'ERR_IPB':
handleInsufficientBalance();
break;
case 'ERR_IS':
handleSessionExpired();
break;
default:
handleUnexpectedError(response.status?.statusCode);
}
// ❌ Bad - Generic error handling only
if (response.status?.statusCode !== 'SUCCESS') {
showGenericError();
}// ✅ Good
function getErrorMessage(statusCode: string, context: string): string {
const messages = {
betting: {
'ERR_IPB': 'You need more balance to place this bet',
'ERR_GLE': 'This bet exceeds your daily limit'
},
authentication: {
'ERR_IS': 'Please log in again to continue',
'ERR_ATE': 'Login failed - please check your credentials'
}
};
return messages[context]?.[statusCode] || 'An error occurred';
}// ✅ Good
if (response.status?.statusCode !== 'SUCCESS') {
console.error('RGS Error:', {
function: 'play',
statusCode: response.status.statusCode,
statusMessage: response.status.statusMessage,
timestamp: new Date().toISOString()
});
}- Error Handling - Comprehensive error handling guide
- Common Issues - Solutions to frequent problems
- Debug Guide - Debugging tips and tools
- Getting Started - Basic setup and error prevention