Enhanced error message

This commit is contained in:
Uriziel 2012-09-17 20:32:59 +02:00
parent 70e0eb7163
commit 9564c87fd7
5 changed files with 18 additions and 9 deletions

View File

@ -1,10 +1,10 @@
#coding:utf8
from setuptools import find_packages
import syncplay
common_info = dict(
name = 'Syncplay',
version = '0.9',
version = syncplay.version,
author = 'Tomasz Kowalczyk, Uriziel',
author_email = 'code@fluxid.pl, urizieli@gmail.com',
description = 'Syncplay',

View File

@ -0,0 +1,3 @@
version = '0.2.0'
milestone = 'Clara'
projectURL = ''

View File

@ -2,6 +2,7 @@
from .utils import ArgumentParser
from functools import wraps
import syncplay
from twisted.protocols.basic import LineReceiver
@ -45,7 +46,7 @@ class CommandProtocol(LineReceiver):
self.transport.loseConnection()
def dropWithError(self, error):
self.sendMessage('error', error)
self.sendMessage('error', syncplay.version, error)
self.drop()

View File

@ -4,6 +4,7 @@ import re
import time
import random
from twisted.internet import reactor
from twisted.internet.protocol import Factory
@ -27,11 +28,11 @@ class SyncServerProtocol(CommandProtocol):
def handle_init_iam(self, args):
if not len(args) == 1:
self.drop_with_error('Invalid arguments')
self.dropWithError('Invalid arguments')
return
name = re.sub('[^\w]','',args[0])
if not name:
self.drop_with_error('Invalid nickname')
self.dropWithError('Invalid nickname')
return
self.factory.add_watcher(self, name)
self.change_state('connected')
@ -51,7 +52,7 @@ class SyncServerProtocol(CommandProtocol):
def handle_connected_state(self, args):
args = self.__parse_state(args)
if not args:
self.drop_with_error('Malformed state attributes')
self.dropWithError('Malformed state attributes')
return
counter, ctime, paused, position, _ = args
self.factory.update_state(self, counter, ctime, paused, position)
@ -72,7 +73,7 @@ class SyncServerProtocol(CommandProtocol):
ctime = int(ctime)
position = int(position)
except ValueError:
self.drop_with_error('Invalid arguments')
self.dropWithError('Invalid arguments')
ctime /= 1000.0
position /= 1000.0
@ -85,7 +86,7 @@ class SyncServerProtocol(CommandProtocol):
try:
ctime = int(ctime)
except ValueError:
self.drop_with_error('Invalid arguments')
self.dropWithError('Invalid arguments')
ctime /= 100000.0

View File

@ -7,6 +7,7 @@ from __future__ import print_function
import threading
import re
import time
import syncplay
class ConsoleUI(threading.Thread):
def __init__(self):
self.promptMode = threading.Event()
@ -87,4 +88,7 @@ class ConsoleUI(threading.Thread):
self.showMessage( "\ts+ [time] - seek to: current position += time" )
self.showMessage( "\tr - revert last seek" )
self.showMessage( "\tp - toggle pause" )
self.showMessage( "\troom [room] - change room, if unspecified go to default" )
self.showMessage("Syncplay version: %s" % syncplay.version)
self.showMessage("More info available on: %s" % syncplay.projectURL)
else:
self.showMessage( "Unrecognized command, type 'help' for list of available ones" )