fixes some error messages responses
This commit is contained in:
parent
6665e51905
commit
76457a229a
1 changed files with 11 additions and 1 deletions
|
|
@ -66,10 +66,20 @@ namespace Yavsc.Controllers.Communicating
|
||||||
var uname = User.GetUserName();
|
var uname = User.GetUserName();
|
||||||
// ensure uniqueness of casting stream from this user
|
// ensure uniqueness of casting stream from this user
|
||||||
var existent = Casters[uname];
|
var existent = Casters[uname];
|
||||||
if (existent != null) return new BadRequestObjectResult("not supported, you already casting, there's support for one live streaming only");
|
if (existent != null)
|
||||||
|
{
|
||||||
|
ModelState.AddModelError("error","not supported, you already casting, there's support for one live streaming only");
|
||||||
|
return new BadRequestObjectResult(ModelState);
|
||||||
|
}
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
// get some setup from user
|
// get some setup from user
|
||||||
var flow = _dbContext.LiveFlow.SingleOrDefault(f=> (f.OwnerId==uid && f.Id == id));
|
var flow = _dbContext.LiveFlow.SingleOrDefault(f=> (f.OwnerId==uid && f.Id == id));
|
||||||
|
if (flow == null)
|
||||||
|
{
|
||||||
|
ModelState.AddModelError("error",$"You don't own any flow with the id {id}");
|
||||||
|
return new BadRequestObjectResult (ModelState);
|
||||||
|
}
|
||||||
|
|
||||||
// Accept the socket
|
// Accept the socket
|
||||||
var meta = new LiveCastMeta { Socket = await HttpContext.WebSockets.AcceptWebSocketAsync() };
|
var meta = new LiveCastMeta { Socket = await HttpContext.WebSockets.AcceptWebSocketAsync() };
|
||||||
// Dispatch the flow
|
// Dispatch the flow
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue